Incrementing columns

T

Thomas Krpata

I am trying to automate shading of certain columns based
upon a formula.. I can get the cells to increment
but hor do I get the columns to increment..

ie: from like column AU to column AV to column AW, etc

Dim x as integer
Do while x <= 10
GreenShade = (Range("AU" & Range("A" &
x).value).Value - Range("A" & Range("B" & x).value).Value))
Loop
 
F

Frank Kabel

Hi Thomas
not quite sure what you're trying to to but to<loop through rows AND
columns you may try something like the following:

sub foo()
Dim row_index as long
Dim col_index as integer
dim ret_value

For row_index = 1 to 10
for col_index = 1 to 5
ret_value = ret_value + cells(row_index,col_index).value
next col_index
next row_index
msgbox ret_value
end sub
 

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