Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
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? |
#2
![]() |
|||
|
|||
![]()
Range("NamedRange").Offset(-1,0).Resize(1,5).Select
HTH, Bernie MS Excel MVP "Danny" wrote in message ... 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? |
#3
![]() |
|||
|
|||
![]()
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) "Danny" wrote in message ... 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? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Match function...random search? | Excel Worksheet Functions | |||
How do I edit a Named Range using macro's | Excel Worksheet Functions | |||
Identify the contents of column in a filtered range | Excel Worksheet Functions | |||
How to identify source or location of MAX_VALUE in range | Excel Worksheet Functions | |||
Define a range based on another named range | Excel Worksheet Functions |