So I have a workbook with multiple sheets, each row in each sheet is for a different product and has a date the product arrived along with some other info.
I have a sheet called "GRN-Date Search" where I am allowing users to input specific info and have VBA search through the sheets and copy and paste information.
I have hit a wall when it comes to getting it to search for a user defined date range though.
Here is what I have for a single date to give you an idea. I am new to VBA so I am not sure if it is even possible to use the .find function for a date range?
Any help you can offer would be appreciated.
Sub DateSearch_Click()
If Range("B3") = "" Then
MsgBox "You must enter a date to search"
Range("B3").Select
Exit Sub
Else
'Clear "GRN-Date Search" Sheet Row through End
Sheets("GRN-Date Search").Range("A7:A" & Rows.Count).EntireRow.Clear
'Set myDate variable to value in B3
myDate = Sheets("GRN-Date Search").Range("B3")
'Set initial Paste Row
nxtRw = 7
'Loop through Sheets 2 - 29
For shtNum = 2 To 29
'Search Column b for date(s)
With Sheets(shtNum).Columns(1)
Set d = .Find(myDate)
If Not d Is Nothing Then
firstAddress = d.Address
Do
'Copy each Row where date is found to next empty Row on Summary sheet
d.EntireRow.Copy Sheets("GRN-Date Search").Range("A" & nxtRw)
nxtRw = nxtRw + 1
Set d = .FindNext(d)
Loop While Not d Is Nothing And d.Address <> firstAddress
End If
End With
Next
End If
End Sub