![]() |
Get Range Address from a String
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. -- Steph |
Get Range Address from a String
If you mean convert back to a range..then
Dim myRange as Range Set myRange = Range(Rng) If this post helps click Yes --------------- Jacob Skaria "Steph" wrote: 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. -- Steph |
Get Range Address from a String
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 --------------- Jacob Skaria "Jacob Skaria" wrote: If you mean convert back to a range..then Dim myRange as Range Set myRange = Range(Rng) If this post helps click Yes --------------- Jacob Skaria "Steph" wrote: 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. -- Steph |
Get Range Address from a String
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/) ------------------------------------------------------------------------ Leith Ross's Profile: http://www.thecodecage.com/forumz/member.php?userid=75 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=108727 |
All times are GMT +1. The time now is 01:48 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com