Excel VBA Video Training/ EXCEL DASHBOARD REPORTS

Ozgrid, Experts in Microsoft Excel Spreadsheets

Get Range Address of a Excel Named Range

 

Back to: Excel Custom Function/Formulas . Got any Excel/VBA Questions? Free Excel Help

ALSO SEE: Range Name Tricks and Named Ranges and Constants

Excel has a handy built in feature that allows us to create a list of all named ranges and their corresponding range address. This can be seen by going to Insert>Name>Paste and clicking Paste List. The trouble with this method is the list is not dynamic and must be run again to have the range names and their range addresses updated. There are time when it is far easier to have a function that includes the range address of any named range we type. Let's assume we have a range named called MyNumbers and it references Sheet1 range A1:A10. We can use a custom function like shown below;

=RangeNameAddress(MyNumbers) OR =RangeNameAddress(MyNumbers,0)

To return $A$1:$A$10

or

=RangeNameAddress(MyNumbers,1) or =RangeNameAddress(MyNumbers,True)

To return Sheet1$A$1:$A$10

To be able to use this custom function in a Workbook, you must first place the code below into a standard module.

  1. Open the Workbook.
  2. Go to Tools>Macro>Visual Basic Editor (Alt+F11).
  3. Then to Insert>Module.
  4. Paste in the code.
  5. Click the top right X to return to Excel.

The Code

Function RangeNameAddress(Range_Name _

          As Range, Optional SheetName As Boolean) As String

               

    Dim strName As String

    Application.Volatile



    If SheetName = True Then

        strName = "'" & Range_Name.Parent.Name & "'!" & _

        Range_Name.Address

    Else

        strName = Range_Name.Address

    End If

   

    RangeNameAddress = strName

End Function

Now simply enter the function into any cell as shown above.

Excel Dashboard Reports & Excel Dashboard Charts 50% Off Become an ExcelUser Affiliate & Earn Money

Special! Free Choice of Complete Excel Training Course OR Excel Add-ins Collection on all purchases totaling over $64.00. ALL purchases totaling over $150.00 gets you BOTH! Purchases MUST be made via this site. Send payment proof to [email protected] 31 days after purchase date.


Instant Download and Money Back Guarantee on Most Software

Excel VBA Video Training/ EXCEL DASHBOARD REPORTS

Excel Trader Package Technical Analysis in Excel With $139.00 of FREE software!

Microsoft � and Microsoft Excel � are registered trademarks of Microsoft Corporation. OzGrid is in no way associated with Microsoft

Some of our more popular products are below...
Convert Excel Spreadsheets To Webpages | Trading In Excel | Construction Estimators | Finance Templates & Add-ins Bundle | Code-VBA | Smart-VBA | Print-VBA | Excel Data Manipulation & Analysis | Convert MS Office Applications To...... | Analyzer Excel | Downloader Excel | MSSQL Migration Toolkit | Monte Carlo Add-in | Excel Costing Templates