473,386 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Looping cell changes

1
Hello there. It's been awhile since I programmed in VBA, but as my job at the University has me working with some pretty big spreadsheets I am heading into VB to make my own UDF. Here is what I have so far:

Function NewLook(j As Integer, k As Integer)
'Initialize the Array
Dim aSize As Integer
aSize = 4200 - j
Dim bSize As Integer
bSize = k - 5
Dim a(4200) As Double
Dim b(4200) As Double
For i = aSize To 4200 Step 1
a(i) = Cells(i, 29).value
Next i
For i = 6 To bSize Step 1
b(i) = Cells(i, 14).value
Next i
Dim count As Integer
Dim v As Double
Dim thing As Integer
For c = 1325 To bSize Step 1
thing = c
v = Abs((b(c) - a(j)))
For d = j To 4200 Step 1
If v > Abs((b(c) - a(d))) Then
v = Abs((b(c) - a(d)))
count = d
Debug.Print (count)
End If
Next d
Cells(thing, 43) = count
Next c

You can pretty much ignore everything until the bottom. That is where I will be updating each cell with the value needed. This has to be done somewhere between 2000-4200 times. I tried adding a Sub that the function above calls and does the Cells(thing, 43) = count line but it does not work.

Any suggestions?
May 21 '09 #1
0 997

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: RdR | last post by:
Hi, Has anyone encountered infinite looping in Q Replication? This happens when I have a source DB2 table A going to a target DB2 table B, it also happens that the samne target table B is...
2
by: DraguVaso | last post by:
Hi, I'm looking for a nice way to format the cell of my datagrid according to some predefined 'rules'. I found a lot on the site of George shepherd, but it wasn't really what I was looking for:...
1
by: Suresh | last post by:
I am trying to display the totals from several columns from the grid and update them as the user moves from cell to cell. I have no problems going from cell to cell but when the user changes a...
2
by: johnnyG | last post by:
I've tried this approach but it's not quite what I want: Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, _ ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) _ Handles...
3
by: Henry Jones | last post by:
I am using VB.NET VS 2005 and I have a datagridview bound to a table. This table has rate information on bank loans. The fiels are ProductName, MinDeposit, Rate, and PreviousRate On the grid...
7
by: Arne Beruldsen | last post by:
in vbnet2005 I have a datagridview. When the user clicks on a row...I would like the contents of certain cells to populate a textbox. To do this...i need to be able to refer to the row and...
0
by: =?Utf-8?B?QnJpYW5ESA==?= | last post by:
Hi I am trying to find a way to change the background color of a cell (flash or blink) when its value has changed (by user or data update). I need to be able to do this for more than one cell...
2
by: Paulo | last post by:
Hi, I have a grid with a template column wich is a TextBox, how can I retrieve the values typed by the user? I tried the code below but it always returns empty string: for (int i = 0; i <...
0
by: aboobackerpm | last post by:
i am using a binded dgv with datatable my problem is how i can update the changes in a cell of a dgv to datatable without move to next cell my dgv's allow addnew property is false because of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.