Results 1 to 12 of 12

How to make a commandbutton show in all sheets?

Threaded View

  1. #1
    Registered User
    Join Date
    02-02-2010
    Location
    Belgium
    MS-Off Ver
    Excel 2003
    Posts
    47

    How to make a commandbutton show in all sheets?

    Hey,

    can someone tell me how I make buttons show in all sheets and in all newly created sheets?

    I have about 10 sheets wit the same commandbuttons with these same codes asigned to them by copying these codes for every sheet.

    Private Sub CommandButton1_Click()
    On Error GoTo err_handler
        ActiveWorkbook.FollowHyperlink Address:="\\private\workbook.XLS", SubAddress:=" 'sheet1'!a1", _
        NewWindow:=True
    Exit Sub
    err_handler:
    End Sub
    
    Private Sub CommandButton2_Click()
    On Error GoTo err_handler
        ActiveWorkbook.FollowHyperlink Address:="\\private\workbook.XLS", SubAddress:=" 'Sheet2'!a1", _
        NewWindow:=True
    Exit Sub
    err_handler:
    End Sub
    
    Private Sub CommandButton3_Click()
    On Error GoTo err_handler
        ActiveWorkbook.FollowHyperlink Address:="\\private\workbook.XLS", SubAddress:=" 'Sheet3'!a1", _
        NewWindow:=True
    Exit Sub
    err_handler:
    End Sub
    
    Private Sub CommandButton4_Click()
    On Error GoTo err_handler
        ActiveWorkbook.FollowHyperlink Address:="\\private\workbook.XLS", SubAddress:=" 'Sheet4'!a1", _
        NewWindow:=True
    Exit Sub
    err_handler:
    End Sub
    
    Private Sub CommandButton5_Click()
    On Error GoTo err_handler
        ActiveWorkbook.FollowHyperlink Address:="\\private\workbook.XLS", SubAddress:=" 'sheet5'!a1", _
        NewWindow:=True
    Exit Sub
    err_handler:
    End Sub
    Private Sub CommandButton6_Click()
    On Error GoTo err_handler
        ActiveWorkbook.FollowHyperlink Address:="\\private\workbook.XLS", SubAddress:=" 'sheet6'!a1", _
        NewWindow:=True
    Exit Sub
    err_handler:
    End Sub
    Can I not put these codes in the "This workbook" and only make these commandbuttons on sheet1. So all the other sheets display these buttons to and also work with the codes?
    Last edited by Bluewhistler; 04-14-2010 at 11:16 AM. Reason: Solved by romperstomper

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1