ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Select rows to format (https://www.excelbanter.com/excel-programming/342176-select-rows-format.html)

Les Stout[_2_]

Select rows to format
 
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

*** Sent via Developersdex http://www.developersdex.com ***

Dave Peterson

Select rows to format
 
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.)



Les Stout wrote:

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

*** Sent via Developersdex http://www.developersdex.com ***


--

Dave Peterson

Les Stout[_2_]

Select rows to format
 
Hi Dave, i need to format the last row and the next 3 rows.


Thanks for the help.

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***

Dave Peterson

Select rows to format
 
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

Les Stout wrote:

Hi Dave, i need to format the last row and the next 3 rows.

Thanks for the help.

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***


--

Dave Peterson

Les Stout[_2_]

Select rows to format
 
Thanks Dave, had figured it out in the meantime.

great weekend !!

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***


All times are GMT +1. The time now is 10:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com