[Solved] VBA: Name a region

  • I'd like the macro to name a region. Whenever the macro is run, it will start in cell B9, select the current region (list), and then define that range as a named region. When I attempt to record this macro, it records the specific cells that the current list occupies. The problem with this method is that sometimes the list will be larger or smaller, so I need the macro to be based off the CurrentRegion (as selected in step two below).

    What can I use besides "RefersToR1C1:="='Individual Pivots'!R8C2:R11C5" to accomplish this?

    Current code:

    ActiveWorkbook.Names.Add Name:="namedregion", RefersToR1C1:= _
    "='Individual Pivots'!R8C2:R11C5"

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!