ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   selecting a worksheet page (https://www.excelbanter.com/excel-programming/377596-selecting-worksheet-page.html)

Jim T.[_2_]

selecting a worksheet page
 
I can use the following code on a button on the cover sheet, but how do I
modify it if I want to use it in a form? When I use it it seems to see right
through it and click on the form itself.

Sub ShowSheetList()

On Error Resume Next
If ActiveWorkbook.Sheets.Count <= 16 Then
Application.CommandBars("Workbook Tabs"). _
ShowPopup 500, 225
Else
Application.CommandBars("Workbook Tabs"). _
Controls("More Sheets...").Execute
End If
On Error GoTo 0

End Sub

JLGWhiz

selecting a worksheet page
 
It is much more simple to put a new button on the form and then attach the
macro to it. You can then delete the old button.

"Jim T." wrote:

I can use the following code on a button on the cover sheet, but how do I
modify it if I want to use it in a form? When I use it it seems to see right
through it and click on the form itself.

Sub ShowSheetList()

On Error Resume Next
If ActiveWorkbook.Sheets.Count <= 16 Then
Application.CommandBars("Workbook Tabs"). _
ShowPopup 500, 225
Else
Application.CommandBars("Workbook Tabs"). _
Controls("More Sheets...").Execute
End If
On Error GoTo 0

End Sub


Jim T.[_2_]

selecting a worksheet page
 
I tried using a new button but when it pops up and I click on a sheet nothing
happens except the pop up window disappears. Any other ideas?

"JLGWhiz" wrote:

It is much more simple to put a new button on the form and then attach the
macro to it. You can then delete the old button.

"Jim T." wrote:

I can use the following code on a button on the cover sheet, but how do I
modify it if I want to use it in a form? When I use it it seems to see right
through it and click on the form itself.

Sub ShowSheetList()

On Error Resume Next
If ActiveWorkbook.Sheets.Count <= 16 Then
Application.CommandBars("Workbook Tabs"). _
ShowPopup 500, 225
Else
Application.CommandBars("Workbook Tabs"). _
Controls("More Sheets...").Execute
End If
On Error GoTo 0

End Sub



All times are GMT +1. The time now is 04:26 AM.

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