Saturday, 11 July 2015

How to Loop through Named Ranges in Excel

VBA Macro to Loop through Named Ranges in Excel
Sub Loop_Names()

Dim MyRng As Name

For Each MyRng In ThisWorkbook.Names

If InStr(MyRng.Name, "My_PPT") Then
'Displaying Range Name
MsgBox MyRng.Name
'Displaying the Range Reference
MsgBox MyRng.RefersToRange.Address
'Displaying the Range existed Sheet Name
MsgBox MyRng.RefersToRange.Parent.Name
End If

Next MyRng


End Sub

No comments:

Post a Comment

Follow Me by Email

ExcelKingdom-Popular Posts

ExcelKingdom-Random Posts