PDA

View Full Version : [SOLVED:] If current sheet is...



Sir Babydum GBE
09-02-2005, 03:08 AM
Hi,

Okay, I here expose my thickoness to you all...

In vba, how to I say correctly "If the current sheet is "mySheet1" then do this, otherwise, If the current sheet is "mySheet2" then do that?

Thanks my, er, gurus

Marcster
09-02-2005, 03:45 AM
Hi Babydum,

Try this:



If ThisWorkbook.ActiveSheet.Name = "mySheet1" Then
MsgBox "Active sheet is mySheet1"
ElseIf ThisWorkbook.ActiveSheet.Name = "mySheet2" Then
MsgBox "Active sheet is mySheet2"
Else
MsgBox "Neither mySheet1 or mySheet2"
End If


Marcster.

Sir Babydum GBE
09-02-2005, 04:35 AM
Poifect! Thanks!!