Posted to microsoft.public.excel.programming
|
|
Sheet name ref in cell B2 and then!
Dave:
I've tried this one (the second part) and it failed. I've looked at the link
you suggested on Macro's. I'm still lost, a bit, I think! Should I drop this
section of code in the Macro section VB editor?
Thanks,
"Dave Peterson" wrote:
#1. http://contextures.com/xlfaqFun.html#SheetName
(From Debra Dalgleish's site)
#2. You'll need a macro. But your worksheet names are non-standard. Did you
want to abbreviate the month name or not? I'm assuming that you abbreviated to
3 characters.
Option Explicit
Sub auto_Open()
Dim wks As Worksheet
Dim RevWks As Worksheet
Dim myName As String
Set RevWks = ThisWorkbook.Worksheets("Review")
RevWks.Visible = xlSheetVisible
For Each wks In ThisWorkbook.Worksheets
If wks.Name = RevWks.Name Then
'skip it
Else
wks.Visible = xlSheetHidden
End If
Next wks
myName = Format(Date, "mmm yyyy") ' "mmmm yyyy" maybe????
On Error Resume Next
ThisWorkbook.Worksheets(myName).Visible = xlSheetVisible
If Err.Number < 0 Then
MsgBox "Missing worksheet named: " & myName _
& vbLf & "Please contact Jay!"
Err.Clear
End If
On Error GoTo 0
End Sub
If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
Jay wrote:
Guys, what I'd like to do is a two part process:
1.) Show the current sheet name in cell B2 of that sheet. I have the sheets
named as: Jan 2006, Feb 2006, March 2006, April 2006, etc, etc, etc
Then
2.) When the work book is opened, to open it to the current/active month
(Jan 2006, Feb 2006, March 2006, April 2006, etc, etc, etc), and keep the
other similarly named month sheets, minus the review sheet hidden. This, I
know will require some coding, maybe not, I'm not sure. Given the nature of
this application, however, would the second (question #2) part be possible
also?
Looking forward to your reply....
Thanks
--
Dave Peterson
|