1. Engineering
  2. Computer Science
  3. im trying to create a macro for vba that grabs...

Question: im trying to create a macro for vba that grabs...

Question details

I'm trying to create a macro for vba that grabs values entered in my A column of cells 1-1000, and then takes those values and plugs them into an function.

Rather than define a 1000 differnt values as:

x1 = Worksheets("Sheet1").Range("A1").Value

x2 = Worksheets("Sheet1").Range("A2").Value

x3 = Worksheets("Sheet1").Range("A3").Value

... etc

and then plugging them into my function (note this isn't my actual function but its just an example)

fx= x1+x2+x3....

is there someway I can create a do loop that runs from cell A1 to A1000 grabbing each of their own values and plugging it into my function? Here's what I have so far but I'm not sure how I would have it grab the values entered in the cells.

xi = 1
Do
xi = 1 + xi
If xi = 1000 Then Exit Do
Count = Count + 1

Loop

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution