MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Using macro to enter value in one cell from range of cells


Posted by JP on February 13, 2001 3:09 PM

I built a model that is driven by the value in one cell.
I have 200 values which I need to run the model from.
I would like to build a macro which takes the first of the 200
values, calculates the effect on the model, prints, and then moves
to the second of the 200 and performs the same steps, and continues
until all 200 values have been used. Can anyone help me?

Thanks!


Posted by Dave Hawley on February 13, 2001 10:59 PM


Hi JP

Sounds like you need a simple loop:

Dim MyCell as Range
For each MyCell in range("A1:K500")
If MyCell="Whatever" then
<Your code>
Else
<Your alternate code>
End if
Next MyCell

Dave

OzGrid Business Applications

Posted by Dave Hawley on February 13, 2001 11:00 PM


Hi JP

Sounds like you need a simple loop:

Dim MyCell as Range
For each MyCell in range("A1:K500")
If MyCell="Whatever" then
'Your code
Else
'Your alternate code
End if
Next MyCell

Dave

OzGrid Business Applications