JohnZ1156
Board Regular
- Joined
- Apr 10, 2021
- Messages
- 180
- Office Version
- 2021
- Platform
- Windows
I have a vba script to check if a specific date exists in the current active cell, I would like it to check if an inputted date exists anywhere in the column.
I guess I'm looking for the "With Range(ActiveCell.Address)" to be the entire Date colmun in my Table4 table.
I guess I'm looking for the "With Range(ActiveCell.Address)" to be the entire Date colmun in my Table4 table.
VBA Code:
Dim var As Date
'Enter Date
var = InputBox("Please enter the Date.", "Date", Default, XPos:=2880, YPos:=5760)
Worksheets("Sheet1").Select
Range("B15").Value = var
Range("A11").End(xlDown).Select
[B] With Range(ActiveCell.Address)[/B]
If Not IsDate(.Value) Then
MsgBox "No date"
ActiveCell.Offset(1, 0).Select
ElseIf .Value = var Then
MsgBox ("Data entered " & var & " already exists.")
ActiveCell.Offset(1, 0).Select
Worksheets("Sheet2").Select
Else