Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 89
Default 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.)
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,173
Default 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.)


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,726
Default 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.)



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using macro to select a range Rob Excel Worksheet Functions 3 November 6th 06 09:31 PM
macro code to sort a range ashish128 Excel Discussion (Misc queries) 5 August 17th 06 05:52 PM
checking that cells have a value before the workbook will close kcdonaldson Excel Worksheet Functions 8 December 5th 05 05:57 PM
Highlight Range - wrong macro, please edit. Danny Excel Worksheet Functions 8 October 19th 05 11:11 PM
Macro to change Chart Range when inserting a column Mark Charts and Charting in Excel 1 September 13th 05 01:12 PM


All times are GMT +1. The time now is 10:36 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"