Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default 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 ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default 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 ***
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Select rows to format

Thanks Dave, had figured it out in the meantime.

great weekend !!

Les Stout

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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
select multiple rows and format sdg8481 Excel Discussion (Misc queries) 7 October 5th 08 03:46 PM
How can i randomly select 780 rows from 4000 rows of data bbb Excel Worksheet Functions 2 July 6th 07 08:21 PM
select block of rows w/data between blank rows Janna Excel Programming 6 February 13th 05 02:45 AM
Unable to select rows in the repeat rows on top option Noppie Excel Discussion (Misc queries) 2 December 28th 04 03:17 PM
When I select "format cells", the format dialog box does not disp. Andy S. Excel Worksheet Functions 2 November 23rd 04 03:49 AM


All times are GMT +1. The time now is 12:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"