Collect value

C

cferoiu

I have 4 cells: H8 I8 J8 K8
If change H8, I8 J8 K8 cells have variable value.
I want to change values of H8 from 10 to 150 and collect all 4 cells value
in columns AF AG AH AI.

Please help me with same VBA code. Thanks.
 
B

B Lynn B

Since you didn't specify where to put the collected values, this will drop
them into range A1:D141. Of course you'll want to modify to put them where
you really want them:

Sub myCalcsCollector()

Dim myNum as long

For myNum = 10 to 150
Range("H8") = myNum
application.calculate
cells(myNum - 7, 1) = myNum
cells(myNum - 7, 2) = range("I8")
cells(myNum - 7, 3) = range("J8")
cells(myNum - 7, 4) = range("K8")
Next myNum

If automatic calculation is turned on, then of course you don't need the
line to force calculation.
 
B

B Lynn B

Oh, sorry, you did say the columns you wanted to put them in. Below is the
same thing, but assumes starting at row 8.
 
S

Shane Devenshire

Hi,

What exactly do you mean by "collect all 4 cell values"?
Where in columns AF:AI do you want to put them? (What row?)
What do you mean by change values of H8 from 10 to 150? H8 is only one cell?

Let's suppose you mean you want to copy the entries in H8:K8 to AF8:AI8 then
this code will do it:

[AF8:AI8] = [H8:K8].Value
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top