Hi,
I am trying to get a code to work:
Private Sub Workbook_Open()
Dim varRes As Variant
Application.ScreenUpdating = False
With Worksheets("Rota")
On Error Resume Next
If varRes = WorksheetFunction.Match(CDbl(Date), .Columns(2), 0) = True Then
varRes = WorksheetFunction.Match(Worksheets("Extract 2").Range("R1"), .Columns(1), 0)
End If
On Error GoTo 0
If (Not IsError(varRes) And Len(varRes) > 0) Then Application.GoTo .Cells(varRes, 1), True
End With
Application.ScreenUpdating = True
End Sub
What I'm trying to get it to do is if the date appears in Column 2 of the workbook "Rota" for the code to then Select the cell of the match of Extract 2 R1 in Rota column 1 and if the date isnt in Column 2 to do nothing
I'm thinking:
If varRes = WorksheetFunction.Match(CDbl(Date), .Columns(2), 0) = True Then
is wrong and i might need and "Else Goto" somewhenre in there.
Thanks in advance. John
Bookmarks