![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Mar 2002
Location: Near the Land of Oz
Posts: 1,550
|
I remember seeing a response recently about a formula that takes the worksheet "name" and then inserts that into a cell on that worksheet.
[Nuts! I tried to search, but the search function isn't working right now, and I have searched 25+ pages and can't find what I need.]
__________________
- old, slow, and confused ... but at least I'm inconsistent - (retired Excel 2003 user, 3.28.2008)
|
|
|
|
|
|
#2 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Quote:
|
|
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Posts: 74
|
__________________
"Interfere? Of course we should interfere! Always do what you're best at, that's what I say!" -- The Doctor, Nightmare of Eden |
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Apr 2002
Location: Oregon
Posts: 77
|
try this
Sub sheet_name() Range("a1") = ActiveSheet.Name End Sub |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Mar 2002
Location: Near the Land of Oz
Posts: 1,550
|
Thanks, Ivan, that's the approach I'm looking for.
However, that only works once in the entire workbook. I have seven tabs: Q1-01, Q2-01, Q3-01 Q4-01, Q1-Q2, Q1-Q3, Q1-Q4. Once I pasted in your formula into cell Q1-01!J3, it did what I wanted ("Q1-01" was in the cell). But when I pasted the formula into another sheet (Q2-01!J3), it took the name of that one ("Q2-01"), and then when I went back to worksheet Q1-01, that cell (Q1-01!J3) had changed to Q2-01.
__________________
- old, slow, and confused ... but at least I'm inconsistent - (retired Excel 2003 user, 3.28.2008)
|
|
|
|
|
|
#6 |
|
MrExcel MVP
Join Date: Mar 2002
Location: Chicago, IL USA
Posts: 2,042
|
Hi,
If you want a worksheet function which is easier to use than the =MID(CELL(.... try the following UDF: Public Function NameSheet() NameSheet = Application.Caller.Parent.Name End Function Called as =NAMESHEET() |
|
|
|
|
|
#7 |
|
Board Regular
Join Date: Mar 2002
Posts: 363
|
if you use Ivan's approach you should add a cell reference (a1) after "filename" to the formula to assure you get name of the active sheet without the need to recalc:
=MID(CELL("filename",a1),FIND("]",CELL("filename",a1),1)+1,255)
__________________
It's never too late to learn something new. Ricky |
|
|
|
|
|
#8 |
|
Board Regular
Join Date: Mar 2002
Location: Near the Land of Oz
Posts: 1,550
|
Thanks, everyone!
Ricky, that little extra made the difference. And all of you made my day!!!
__________________
- old, slow, and confused ... but at least I'm inconsistent - (retired Excel 2003 user, 3.28.2008)
|
|
|
|
|
|
#9 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Quote:
Multisheet use. |
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|