Naming a range during macro execution
Has anyone found a way of getting a macro to name a selected range that may
be a different selection every time the macro is executed? I'm talking about a relative range name, but the relative button doesn't work for this. The macro always records the name as an absolute reference to the range selected during recording, rather than applying it during execution as a result of actual keystrokes. (Computer users of yesteryear (pre-Windows) will remember like me with both nostalgia and frustration the power that spreadsheets such as Enable and Lotus provided as far back as twenty years ago in being able (among many other gems) to record macros as kesytsrokes, rather than as the results of keystrokes.) |
Naming a range during macro execution
Kevryl
Why use a macro at all...check Debra's site here http://www.contextures.com/xlNames01.html#Dynamic -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England DTHIS www.nickhodge.co.uk "Kevryl" wrote in message ... Has anyone found a way of getting a macro to name a selected range that may be a different selection every time the macro is executed? I'm talking about a relative range name, but the relative button doesn't work for this. The macro always records the name as an absolute reference to the range selected during recording, rather than applying it during execution as a result of actual keystrokes. (Computer users of yesteryear (pre-Windows) will remember like me with both nostalgia and frustration the power that spreadsheets such as Enable and Lotus provided as far back as twenty years ago in being able (among many other gems) to record macros as kesytsrokes, rather than as the results of keystrokes.) |
Naming a range during macro execution
Something along the lines of
iLastRow = Cells(Rows.Count, "A").End(xlUp).Row ActiveWorkbook.Names.Add Name:="myRange", RefersTo:="=Sheet1!R1C1:R" & _ iLastRow & "C1" -- --- HTH Bob (change the xxxx to gmail if mailing direct) "Kevryl" wrote in message ... Has anyone found a way of getting a macro to name a selected range that may be a different selection every time the macro is executed? I'm talking about a relative range name, but the relative button doesn't work for this. The macro always records the name as an absolute reference to the range selected during recording, rather than applying it during execution as a result of actual keystrokes. (Computer users of yesteryear (pre-Windows) will remember like me with both nostalgia and frustration the power that spreadsheets such as Enable and Lotus provided as far back as twenty years ago in being able (among many other gems) to record macros as kesytsrokes, rather than as the results of keystrokes.) |
All times are GMT +1. The time now is 05:38 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com