ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Determining selected worksheet (https://www.excelbanter.com/excel-programming/279971-determining-selected-worksheet.html)

Bob Conar

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

Dave Peterson[_3_]

Determining selected worksheet
 
lbltitle.caption = activesheet.name & "'s Page"

looks like it might work.

Bob Conar wrote:

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


--

Dave Peterson


Tom Ogilvy

Determining selected worksheet
 
lbltitle.caption = Activesheet.Name & "'s Page"

--
Regards,
Tom Ogilvy


Bob Conar wrote in message
m...
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




Bob Conar

Determining selected worksheet
 
Excellent! Thanks a lot.
Bob Conar

"Tom Ogilvy" wrote in message ...
lbltitle.caption = Activesheet.Name & "'s Page"

--
Regards,
Tom Ogilvy


Bob Conar wrote in message
m...
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



All times are GMT +1. The time now is 09:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com