Ironman
Well-known Member
- Joined
- Jan 31, 2004
- Messages
- 1,069
- Office Version
- 365
- Platform
- Windows
Hi
The below code currently runs in sheet 1.
I would be grateful for an amendment to the 3 rows below so the code will also run in the same range in Sheet 20 (Training 1981-1997):
Many thanks!
The below code currently runs in sheet 1.
Excel Formula:
Sub FindDate()
Dim myDt As Date
Dim myInput As Variant
Dim CellFound As String
If ActiveSheet.Name <> "Training Log" Then
MsgBox "The Locate Entry Date function will only run in Training Log", vbInformation, "Function Invalid in This Sheet"
Exit Sub
Else
End If
On Error GoTo Error1
myInput = InputBox("Enter Date Below: (d/m/yy)", "Locate Training Log Entry Date")
If myInput = "" Then
MsgBox "Search cancelled!", vbInformation, "Locate Training Log Entry Date"
Exit Sub
Else
End If
If IsDate(myInput) Then
myDt = myInput
CellFound = Application.Match(CDbl(myDt), Sheet1.Range("A:A"), 0)
Sheet1.Range("A" & CellFound).Activate
Exit Sub
Else
End If
Error1:
MsgBox "Sorry, no Training Log entry found for that date", vbInformation, "Search Unsuccessful"
End Sub
I would be grateful for an amendment to the 3 rows below so the code will also run in the same range in Sheet 20 (Training 1981-1997):
VBA Code:
If ActiveSheet.Name <> "Training Log"
VBA Code:
CellFound = Application.Match(CDbl(myDt), Sheet1.Range("A:A"), 0)
Sheet1.Range("A" & CellFound).Activate
Many thanks!
Last edited: