• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How do I define a named range as my VBA range

Hi

I have a spreadsheet that is quite dynamic, it generates reports that are split between 3 tables of which each can range between 5 rows to 2500 rows.

I need to be able to define a point (or points) that can easily change.

I have attached the spreadsheet as an example, I need to be able to define the different named ranges (Point 1, 2, 3 and 1 to 2) in VBA - I tried

Dim Point1Num As Range
Set Point1Num = Range(Point1)

But that doesn't work - any advise would be much appreciated. Maybe I'm applying an incorrect technique.
 

Attachments

  • DefineMovingRanges.xlsm
    17.2 KB · Views: 1
Hi James
Just put the named range between quotation marks " " Just like that example
Code:
Sub Test()
    Dim Point1To2_Num As Range
    Set Point1To2_Num = Range("POINT1to2")
   
    MsgBox Point1To2_Num.Address
End Sub
 
Back
Top