have a macro recognize added rows

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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
 
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 (e-mail address removed)>
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?
 

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