I have this vba code which scrolls across a date range to the date entered in cell E4 from column K and returns to column K when E4 is blank
Private Sub Worksheet_Change(ByVal Target As Range) Dim lngMatch As Long If Not Intersect(Target, Range("E4")) Is Nothing Then On Error Resume Next lngMatch = Application.Match(Range("$E$4"), Rows(4), 0) On Error GoTo 0 If lngMatch > 0 Then ActiveWindow.ScrollColumn = Cells(3, lngMatch).Column Else ActiveWindow.ScrollColumn = Cells(3, 11).Column End If End If End Sub
Now it works fine when applied in Worsheet 1 but not when applied to work sheet 2 as well
How do I apply this code to all worksheets in a single workbook? I have 3 worksheets in my workbook.