Macro question

  • Thread starter Thread starter Troy Scott
  • Start date Start date
T

Troy Scott

I recorded a macro to high light some cells and chart the results. I then
assigned a command button to the macro. The only problem is, the number of
rows will never be the same. What can I do to make it stop at the last row
that has numbers in it?

Excel 2002, windows xp.

Thanks,

Troy
 
Hi
try the following
sub foo()
dim lastrow
dim row_index
LastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).row
For row_index = 1 to lastrow
cells(row_index,"A").interior.colorindex = 3
next
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

Back
Top