Consulting

Results 1 to 3 of 3

Thread: Solved: Make Workbook level event local

  1. #1

    Solved: Make Workbook level event local

    Howdy,

    I was given this code for help on a workbook where every sheet had the same structure. I want to use this sub in another workbook where it is only needed in one sheet. Is there a way to localize this?

    Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
    If Target.Row = 7 And Target.Column >= 2 And Target.Column <= 4 Then
    Sh.Range("A7:E49").Sort Key1:=Target.Cells(1, 1), Order1:=xlAscending, Header:=xlYes
    End If
    End Sub

  2. #2
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    Indeed there is...
    In the project explorer, select the sheet you want to control and add the code to the Worksheet_SelectionChange event
    K :-)

  3. #3

Posting Permissions

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