View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Conar Bob Conar is offline
external usenet poster
 
Posts: 4
Default Determining selected worksheet

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