Question: 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

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

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!