VBA, identify a range

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

Guest

I am writing a macro for sorting my worksheet. My macro would select a named
range, for instance the named range is A15. Then I go up one cell to A14 and
select A14 to E 14. The macro would read: Range("A14:E14").Select.

When I add more rows and go to the named range and go up one cell, the row
is no longer Row 14. How do I write the macro for this?
 
Range("NamedRange").Offset(-1,0).Resize(1,5).Select

HTH,
Bernie
MS Excel MVP
 
Set rng = Range("range_name").Offset(-1,0).Resize(1,5)
rng.Sort etc.


--

HTH

RP
(remove nothere from the email address if mailing direct)
 

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