Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
full sheet charts not visible | Charts and Charting in Excel | |||
Number of Sheets (Full of Sheet) | Excel Discussion (Misc queries) | |||
Empty full sheet charts | New Users to Excel | |||
how to erase the full content of a sheet | Excel Programming | |||
Range name & Full Path in Footer | Excel Discussion (Misc queries) |