Get Range Address from a String

S

Steph

I've loaded a cell address into a string via the following macro:

Sub Test()

Dim Rng As String

Rng = ActiveCell.Address(external:=True)
Debug.Print Rng

End Sub

Is there a way to convert the string back to full cell address (workbook,
worksheet, and cell address) without parsing the string?

Thanks for your help.
 
J

Jacob Skaria

If you mean convert back to a range..then

Dim myRange as Range
Set myRange = Range(Rng)

If this post helps click Yes
 
J

Jacob Skaria

Or do you mean,...

Sub Test()
Dim Rng As String
Rng = ActiveCell.Address(external:=True)
Debug.Print Rng

'convert it back
Dim myRange As Range
Set myRange = Range(Rng)
Debug.Print myRange.Address(external:=True)
End Sub

If this post helps click Yes
 
L

Leith Ross

Hello Steph,

By setting an object variable to equal the active cell, you can derive
all the information you want like this...

Dim Addx As String
Dim Rng As Range
Dim WksName As String
Dim WkbName As String

Set Rng = ActiveCell

Addx = Rng.Address
WksName = Rng.Parent.Name
WkbName = Rng.Parent.Parent.Name

Sincerely,
Leith Ross


--
Leith Ross

Sincerely,
Leith Ross

'The Code Cage' (http://www.thecodecage.com/)
 
Top