Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Translating Column Addresses into number/integer
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Translating Column Addresses into number/integer
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. "Andreww" wrote in message ... 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Translating Column Addresses into number/integer
Chrissy - many thanks - I'll give this a ago. It's far more elegent than my
rather ham solution. Regards Andrew "Chrissy" wrote in message ... 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. "Andreww" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
check if a number is integer or fraction | New Users to Excel | |||
Your entry cannot be used. An integer or decimal number may be req | Excel Discussion (Misc queries) | |||
Select range using row and column number addresses | Excel Discussion (Misc queries) | |||
Translating a letter to a number within an array | Excel Worksheet Functions | |||
Identifiyng an integer number from a floating one | Excel Discussion (Misc queries) |