Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default have a macro recognize added rows

I have written a macro to change the cell format over several speciffic
ranges. Two if the ranges are meant to be flexible by added rows. The macro
as an absolute value default does not recognize the added rows and as a
result the format changes in the wrong area. Is there a work around here? A
way to have the macro flex when the rows are added?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default have a macro recognize added rows

The following code will give you the last populated row in Column A on
sheet1. Knowing that you should be able to get your range sorted out. Your
range to format can alse be defined strictly using range objects whish would
probably be more efficient but it also requires a greater understanding...

dim lngLastRow as long

lnglastrow = worksheets("Sheet1").Cells(rows.count, "A").End(xlUp).row
msgbox lngLastRow
--
HTH...

Jim Thomlinson


"Mike M." wrote:

I have written a macro to change the cell format over several speciffic
ranges. Two if the ranges are meant to be flexible by added rows. The macro
as an absolute value default does not recognize the added rows and as a
result the format changes in the wrong area. Is there a work around here? A
way to have the macro flex when the rows are added?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default have a macro recognize added rows


You could use a named range.
Rows inserted into a named range expand the range...
Range("FlexRange").Interior.ColorIndex = 40
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"Mike M." <Mike
wrote in message
I have written a macro to change the cell format over several speciffic
ranges. Two if the ranges are meant to be flexible by added rows. The macro
as an absolute value default does not recognize the added rows and as a
result the format changes in the wrong area. Is there a work around here? A
way to have the macro flex when the rows are added?
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default have a macro recognize added rows

For that Mike you may want to use a dynamic named range...

http://www.cpearson.com/excel/named.htm
--
HTH...

Jim Thomlinson


"Jim Cone" wrote:


You could use a named range.
Rows inserted into a named range expand the range...
Range("FlexRange").Interior.ColorIndex = 40
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"Mike M." <Mike
wrote in message
I have written a macro to change the cell format over several speciffic
ranges. Two if the ranges are meant to be flexible by added rows. The macro
as an absolute value default does not recognize the added rows and as a
result the format changes in the wrong area. Is there a work around here? A
way to have the macro flex when the rows are added?

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
sum to recognize new rows deb Excel Discussion (Misc queries) 3 January 27th 10 09:50 PM
run a macro which looks at ranges with added rows aussiebob New Users to Excel 1 February 19th 09 10:02 AM
Pivot Table Wizard Fails to Recognize New Rows of a Named Range Ed K Excel Worksheet Functions 2 January 23rd 08 12:31 AM
Pivot Table Wizard Fails to Recognize New Rows of Database Ed K Excel Discussion (Misc queries) 2 January 21st 08 03:05 PM
Adding 4 rows after each total criteria in the column A with formatting and added text using macro. [email protected] Excel Programming 9 March 20th 07 06:08 PM


All times are GMT +1. The time now is 06:46 PM.

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

About Us

"It's about Microsoft Excel"