Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 661
Default Getting Sheet name from Full Range in VBA

On sheet1, cell B3 I have a cell that as a result of a formula has the text:

sheet2!$A$4:$B$6

in my VBA Macro I store the text from Sheet1 into a string

Dim myRange as String
myRange = Sheets("sheet1").Range("$B$3")

The sheet reference on sheet1 could change to be another sheet (instead of
"sheet2" it could be "newSheet" or "lastPage" etc.), thus I want to know what
sheet is referenced in myRange, so that I can change an unrelated cell on
that sheet. Is there a way to do that?

Paul
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default Getting Sheet name from Full Range in VBA

Dim MySheet as String
MySheet = Left(MyRange,InStr(1,MyRange,"!")-1)

HTH

Die_Another_Day
Paul wrote:
On sheet1, cell B3 I have a cell that as a result of a formula has the text:

sheet2!$A$4:$B$6

in my VBA Macro I store the text from Sheet1 into a string

Dim myRange as String
myRange = Sheets("sheet1").Range("$B$3")

The sheet reference on sheet1 could change to be another sheet (instead of
"sheet2" it could be "newSheet" or "lastPage" etc.), thus I want to know what
sheet is referenced in myRange, so that I can change an unrelated cell on
that sheet. Is there a way to do that?

Paul


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
full sheet charts not visible Stuart C.[_2_] Charts and Charting in Excel 1 June 19th 09 05:20 PM
Number of Sheets (Full of Sheet) veryeavy Excel Discussion (Misc queries) 2 August 6th 07 12:37 PM
Empty full sheet charts dgc New Users to Excel 4 May 9th 07 08:00 PM
how to erase the full content of a sheet Maileen[_3_] Excel Programming 2 February 22nd 06 12:16 PM
Range name & Full Path in Footer Ajit Munj Excel Discussion (Misc queries) 6 February 9th 05 11:43 PM


All times are GMT +1. The time now is 04:59 PM.

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"