So I have an input box that ask for a date. I enter 03/13/2014 and I want excel VBA to count the number of rows that contain this date in columns Q, R, & S. Below is the code. I know my count piece is off. But I don't know what the correct code should be. Any help is appreciated.
Code
Dim lastRow As Long
lastRow = Range("D" & Rows.Count).End(xlUp).Row
Dim CD As Date
Dim vQuestion
vQuestion = Application.InputBox(Prompt:="What is Today's Date?")
If IsDate(vQuestion) = True Then
CD = DateValue(vQuestion)
Else
MsgBox "Invalid date"
End If
Application.ScreenUpdating = False
For w = lastRow To 2 Step -1
Range("V5").Select
If Range("Q" & w).Value = CD Then
Rows(w).EntireRow.Count
End If
Next w
For b = lastRow To 2 Step -1
Range("V6").Select
If Range("R" & b).Value = CD Then
Rows(b).EntireRow.Count
End If
Next b
For Z = lastRow To 2 Step -1
Range("V7").Select
If Range("S" & Z).Value = CD Then
Rows(Z).EntireRow.Count
End If
Next Z
Application.ScreenUpdating = True
Display More