Determining selected worksheet

B

Bob Conar

I am using a common userform among several worksheets. Each sheet has
a macro button that will launce this userform dialog box. If
sheet(bob) is the one the user is using, I want the userform label
caption to read: "Bob's Page". If sheet(anne) is the one the user is
using, I want the userform label caption to read: "Anne's Page". If
sheet(christy) is the one the user is using, I want the userform label
caption to read: "Christy's Page".

Actually, these sheets are named for modules at the plant. The above
are only examples. We use these sheets to capture downtime from these
areas.

I have unsuccessfully tried this VB:

If ActiveSheet = "bob" Then
lbltitle.caption = "Bob's Page"
ElseIf ActiveSheet = "anne" Then
lbltitle.caption = "Anne's Page"
ElseIf ActiveSheet = "christy" Then
lbltitle.caption = "Christy's Page"
EndIf

'This didn't work, so I tried the following:

If Sheet = "bob" Then
lbltitle.caption = "Bob's Page"

If Sheet.visible = "bob" Then
lbltitle.caption = "Bob's Page"

'Neither of these worked either.

Thank you, Bob Conar
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top