Hi everyone...
brand new to VBA ... just doing a test project.
With the assisstance of 2 wonderful people on here today,
I got this code... but it does not run. I get a Compile Error: Sub or Function not defined. it happens on fCell in the Set fCell line.Since I did not write the code, and do not yet know VBA constants and keywords, I am really lost
Here is the code.
Private Sub CommandButton1_Click()
Dim SearchDay As Date
Dim fCell As Range
SearchDay = InputBox("Enter date to find", "What day?"
With Sheets("Sheet1"
set fCell = .Columns("A"
.Find(Format(SearchDay, .Range("A2"
.NumberFormat), LookIn:=xlValues)
If Not fCell Is Nothing Then
MsgBox "Date Found"
Else
MsgBox "Date Not Found"
End If
End Sub
The original posting of this code did not have fCell dimensioned. Someone told to Dim it as a Range. If I remark the Dim line out, then I get a Variable not defined error.
Any help and/or instructions?
Thanks
Michael
brand new to VBA ... just doing a test project.
With the assisstance of 2 wonderful people on here today,
I got this code... but it does not run. I get a Compile Error: Sub or Function not defined. it happens on fCell in the Set fCell line.Since I did not write the code, and do not yet know VBA constants and keywords, I am really lost
Here is the code.
Private Sub CommandButton1_Click()
Dim SearchDay As Date
Dim fCell As Range
SearchDay = InputBox("Enter date to find", "What day?"
With Sheets("Sheet1"
set fCell = .Columns("A"
If Not fCell Is Nothing Then
MsgBox "Date Found"
Else
MsgBox "Date Not Found"
End If
End Sub
The original posting of this code did not have fCell dimensioned. Someone told to Dim it as a Range. If I remark the Dim line out, then I get a Variable not defined error.
Any help and/or instructions?
Thanks
Michael