I am trying to populate a dynamic named range into a msgBox, but getting error of type mismatch on line Set xRg = xTxt.
Below is the code:
Sub showOfferRange()
Dim xRg As Range
Dim xTxt As String
Dim xCell As Range
Dim xStr As String
Dim xRow As Long
Dim xCol As Long
On Error Resume Next
xTxt = ThisWorkbook.Names("named_range")
Set xRg = xTxt
If xRg Is Nothing Then Exit Sub
On Error Resume Next
For xRow = 1 To xRg.Rows.Count
For xCol = 1 To xRg.Columns.Count
xStr = xStr & xRg.Cells(xRow, xCol).Value & vbTab
Next
xStr = xStr & vbCrLf
Next
MsgBox xStr
End Sub
Much appreciated.