+ Reply to Thread
Results 1 to 2 of 2

Common Private Sub

  1. #1
    Booker
    Guest

    Common Private Sub

    I have 25 same sheets and in everyone is included same Private Sub for cursor
    movement.

    Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
    If Target.Address = "$G$8" Then
    Range("C9").Select
    End If
    ..
    ..
    ..
    If Target.Address = "$D$32" Then
    Range("I3").Select
    End If
    End Sub

    How can I use this macro as one for all sheets to reduce size of file.

    Thanks in advance.

  2. #2
    Bob Phillips
    Guest

    Re: Common Private Sub

    Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
    As Range)
    If Target.Address = "$G$8" Then
    Range("C9").Select
    ElseIf Target.Address = "$D$32" Then
    Range("I3").Select
    End If
    End Sub

    'This is workbook event code.
    'To input this code, right click on the Excel icon on the worksheet
    '(or next to the File menu if you maximise your workbooks),
    'select View Code from the menu, and paste the code



    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Booker" <[email protected]> wrote in message
    news:[email protected]...
    > I have 25 same sheets and in everyone is included same Private Sub for

    cursor
    > movement.
    >
    > Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
    > If Target.Address = "$G$8" Then
    > Range("C9").Select
    > End If
    > .
    > .
    > .
    > If Target.Address = "$D$32" Then
    > Range("I3").Select
    > End If
    > End Sub
    >
    > How can I use this macro as one for all sheets to reduce size of file.
    >
    > Thanks in advance.




+ Reply to Thread

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