Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create a range address with ADDRESS function? Steve McLeod Excel Worksheet Functions 1 December 18th 08 02:02 PM
return cell address of longest text string in a range Dave F[_2_] Excel Discussion (Misc queries) 2 July 12th 07 03:41 PM
Pass a string to an address Robert H Excel Programming 3 February 25th 07 02:18 PM
Using a string to reference an address anna Excel Programming 8 July 31st 06 07:56 PM
Passing Cell Address (String or Range) ExcelMonkey[_190_] Excel Programming 6 March 16th 05 05:11 PM


All times are GMT +1. The time now is 05:36 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"