Select rows to format

  • Thread starter Thread starter Les Stout
  • Start date Start date
L

Les Stout

Hi could somebody please give me the correct code for the following.

LastRow = Cells(Application.Rows.Count, 1).End(xlUp).Row
Rows(LastRow + 2).NumberFormat = "0.00"

I need to format from LastRow + 2 more rows with "0.00"
What i have got formats the second row after the last row ?


thanks in advance

Les Stout
 
dim LastRow as long
with activesheet
lastrow = .cells(.rows.count,1).end(xlup).row
.rows(lastrow +1).resize(2).numberformat = "0.00"
end with

I'm kind of confused about what you want formatted.

Do you mean the lastrow plus the next?

Or do you mean the two after the lastrow?

the +1 says to come down one row, but then format the next two. .resize(2) says
to make that original range .rows(lastrow+1) two rows deep.)
 
Hi Dave, i need to format the last row and the next 3 rows.


Thanks for the help.

Les Stout
 
Don't add +1
and resize to include 4 rows...

dim LastRow as long
with activesheet
lastrow = .cells(.rows.count,1).end(xlup).row
.rows(lastrow).resize(4).numberformat = "0.00"
end with
 
Back
Top