Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 788
Default replacing defined names for ranges

If I go to Insert | Name -- Define and define a name as a range, can I just
replace an absolute range in VBA with the named range?

For example my named range is called ValuesX1.
ValuesX1 = offset($C$1,0,0,countif($A:A$,1),1)

When I record a macro and autofill a range in column C, my VBA code looks
like this: Selection.AutoFill Destination:=Range("Y1:Y61")

However my range changes for different worksheets so can I just replace
"Y1:Y61" with ValuesX1?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default replacing defined names for ranges

Yes, just use

Selection.AutoFill Destination:=Range("ValuesX1")

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Chris" wrote in message
...
If I go to Insert | Name -- Define and define a name as a range, can I

just
replace an absolute range in VBA with the named range?

For example my named range is called ValuesX1.
ValuesX1 = offset($C$1,0,0,countif($A:A$,1),1)

When I record a macro and autofill a range in column C, my VBA code looks
like this: Selection.AutoFill Destination:=Range("Y1:Y61")

However my range changes for different worksheets so can I just replace
"Y1:Y61" with ValuesX1?



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
Replacing a list of codes with names Mortir Excel Worksheet Functions 3 May 30th 08 04:06 PM
Replacing A,B,C column names to other names Lisa H Excel Discussion (Misc queries) 4 July 11th 07 06:28 PM
Replacing Range Names Jim May Excel Discussion (Misc queries) 2 October 25th 06 12:54 PM
searching names for '*', replacing it with first name [email protected] Excel Programming 3 July 11th 06 08:55 AM
replacing just the sheet names within formulas Jeanne Criez Excel Worksheet Functions 1 January 4th 05 06:27 PM


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

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

About Us

"It's about Microsoft Excel"