Not Sure if this is possible ???

mercmannick

Well-known Member
Joined
Jan 21, 2005
Messages
730
Hi

i have a WB with over 28 sheets in is there any way of having a box wether it MsgBox or anything to give the user a choice of which sheet to goto , dont have room to add a list of hyperlinks , was wondering if this was possible atall

Many Thanks

Nick
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Try right clicking on the little arrow buttons to the left of the sheet tabs
 
Upvote 0
Try right clicking on the little arrow buttons to the left of the sheet tabs

Hi jonmo1

was hoping to have something like a dialogbox or similar to allow navigation to be easier
is this sort of thing possible

Nick
 
Upvote 0
Did that not produce a dialogue window with choices of sheets to select??
 
Upvote 0
Yes Jonmo1

but as there is 28 sheets it only shows first 15 , i wanted it to make more user friendly , i have been looking at code posted that allows selecting and printing of some or all pages as below , could this be modified to suit , instead of check boxes option button and instead of print goto sheet ,

Code:
 Sub SelectSheets()
    '   John Walkenbach
    '   www.j-walk.com
    Dim i As Integer
    Dim TopPos As Integer
    Dim SheetCount As Integer
    Dim PrintDlg As DialogSheet
    Dim CurrentSheet As Worksheet, FinalSheet As Worksheet
    Dim cb As CheckBox
    Application.ScreenUpdating = False

    Set FinalSheet = ActiveSheet
    
'   Check for protected workbook
    If ActiveWorkbook.ProtectStructure Then
        MsgBox "Workbook is protected.", vbCritical
        Exit Sub
    End If

'   Add a temporary dialog sheet
    Set CurrentSheet = ActiveSheet
    Set PrintDlg = ActiveWorkbook.DialogSheets.Add

    SheetCount = 0

'   Add the checkboxes
    TopPos = 40
    For i = 1 To ActiveWorkbook.Worksheets.Count
        Set CurrentSheet = ActiveWorkbook.Worksheets(i)
'       Skip empty sheets and hidden sheets
        If Application.CountA(CurrentSheet.Cells) <> 0 And _
            CurrentSheet.Visible Then
            SheetCount = SheetCount + 1
            PrintDlg.CheckBoxes.Add 78, TopPos, 150, 16.5
                PrintDlg.CheckBoxes(SheetCount).Text = _
                    CurrentSheet.Range("A6")  'CurrentSheet.Name
            TopPos = TopPos + 13
        End If
    Next i

'   Move the OK and Cancel buttons
    PrintDlg.Buttons.Left = 240

'   Set dialog height, width, and caption
    With PrintDlg.DialogFrame
        .Height = Application.Max _
            (68, PrintDlg.DialogFrame.Top + TopPos - 34)
        .Width = 230
        .Caption = "Select sheets to print"
    End With

'   Change tab order of OK and Cancel buttons
'   so the 1st option button will have the focus
    PrintDlg.Buttons("Button 2").BringToFront
    PrintDlg.Buttons("Button 3").BringToFront

'   Display the dialog box
    CurrentSheet.Activate
    Application.ScreenUpdating = True
    If SheetCount <> 0 Then
        If PrintDlg.Show Then
            For Each cb In PrintDlg.CheckBoxes
                If cb.Value = xlOn Then
                    Worksheets(cb.Caption).Activate
                    ActiveSheet.PrintOut
'                   ActiveSheet.PrintPreview 'for debugging
                End If
            Next cb
        End If
    Else
        MsgBox "All worksheets are empty."
    End If

'   Delete temporary dialog sheet (without a warning)
    Application.DisplayAlerts = False
    PrintDlg.Delete

'   Reactivate original sheet
    FinalSheet.Activate
End Sub

this would be ideal and just what i am looking for

Thanks

Nick
 
Upvote 0
but as there is 28 sheets it only shows first 15
It also shows one line at the bottom that says "More Sheets", or something to that effect, it will then list ALL the sheets, with a scroll bar if needed.
 
Last edited:
Upvote 0
I can't imagine any VBA code that produces anything more "user friendly" than that...
 
Upvote 0
It also shows one line at the bottom that says "More Sheets", or something to that effect, it will then list ALL the sheets, with a scroll bar if needed.

JonMo1

yes i know that , but unfortunately most users of this WB wouldnt know this , i would like after a code has run to pop up this dialog box and allow navigation to selected sheet

Thanks

Nick
 
Upvote 0
Whatever vba method you use will need some kind of trigger right?
You will have to take time to Instruct the user "How, when, why to trigger the popup" right?

...

but if you want to re-invent the wheel, go right ahead, I'll drop out of this thread.
 
Upvote 0

Forum statistics

Threads
1,217,344
Messages
6,136,019
Members
449,977
Latest member
altizerc2196

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top