VBA, identify a range

D

Danny

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?
 
B

Bernie Deitrick

Range("NamedRange").Offset(-1,0).Resize(1,5).Select

HTH,
Bernie
MS Excel MVP
 
B

Bob Phillips

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)
 
Top