View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
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?