Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Gee
From Bob Phillips... Sub BrowseSheets() Dim i As Integer Dim TopPos As Integer Dim iBooks As Integer Dim PrintDlg As DialogSheet Dim CurrentSheet As Worksheet Dim cb As OptionButton Application.ScreenUpdating = False If ActiveWorkbook.ProtectStructure Then MsgBox "Workbook is protected.", vbCritical Exit Sub End If Set CurrentSheet = ActiveSheet Set PrintDlg = ActiveWorkbook.DialogSheets.Add iBooks = 0 TopPos = 40 For i = 1 To ActiveWorkbook.Worksheets.Count Set CurrentSheet = ActiveWorkbook.Worksheets(i) iBooks = iBooks + 1 PrintDlg.OptionButtons.Add 78, TopPos, 150, 16.5 PrintDlg.OptionButtons(iBooks).text = _ ActiveWorkbook.Worksheets(iBooks).Name TopPos = TopPos + 13 Next i PrintDlg.Buttons.Left = 240 CurrentSheet.Activate With PrintDlg.DialogFrame .Height = Application.Max _ (68, PrintDlg.DialogFrame.Top + TopPos - 34) .Width = 230 .Caption = "Select workbooks to process" End With PrintDlg.Buttons("Button 2").BringToFront PrintDlg.Buttons("Button 3").BringToFront Application.ScreenUpdating = True If PrintDlg.Show Then For Each cb In PrintDlg.OptionButtons If cb.Value = xlOn Then ActiveWorkbook.Worksheets(cb.Caption).Select MsgBox "Worksheet " & Worksheets(cb.Caption).Name & " Selected" Exit For End If Next cb Else MsgBox "Nothing selected" End If Application.DisplayAlerts = False PrintDlg.Delete End Sub Gord Dibben Excel MVP On Thu, 22 Apr 2004 14:40:33 -0700, "Gee" wrote: I'm real new at programing in Excel...Access I've done. I need to know the "on click" code for a command button to open a spreadsheet in a workbook. I've got a table of contents and I want to be able to click the button to go to the proper sheet within that book. Say the sheet is named 24. Thank you in advance for your help. Gee |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
command button add another command | Excel Discussion (Misc queries) | |||
Command Button | Excel Worksheet Functions | |||
command button | Excel Worksheet Functions | |||
Command Button vs Control Button | Excel Programming | |||
Command Button vs Form Button | Excel Programming |