Translating Column Addresses into number/integer

A

Andreww

Hi - I have a for.. next loop that I want to shuttle across columns based on
a supplied cell ref... how do I increment form column to collumn?

For instance I want to move, in a row, allong the columns and when I find an
integer put it else where on the sheet

I thought it might look something like this:

for zz = 1 to 5 ' The rows
for xx = A to G 'The cols
do stuff
next xx
next zz

Any help MUCH appreciated!

Cheers

Andrew
 
C

Chrissy

There are many ways - this one is easy as you can use the
variables in lots of ways.

Sub MySub()
For xx = 4 To 9 'ROW
For yy = 6 To 16 'COL
If Range("A1").Offset(xx, yy) = Int(Range("A1").Offset(xx, yy)) Then
Range("AA1").Offset(xx, yy) = Range("A1").Offset(xx, yy)
End If
Next yy
Next xx
End Sub



This will check cells from F4:p9 to see if they are integers (they must be numbers)
and save the integers into the same cells in the range AF:AP9.

Chrissy.
 
A

Andreww

Chrissy - many thanks - I'll give this a ago. It's far more elegent than my
rather ham solution.

Regards

Andrew
 

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