+ Reply to Thread
Results 1 to 2 of 2

replacing defined names for ranges

  1. #1
    Chris
    Guest

    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. #2
    Bob Phillips
    Guest

    Re: 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" <[email protected]> wrote in message
    news:[email protected]...
    > 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1