Private Sub CommandButton5_Click()
Dim ws As Worksheet, lRow As Integer
For Each ws In Worksheets
If ws.Name <> "Sheet1" Then
lRow = ws.Range("A" & Rows.Count).End(xlUp).Row
For Each cell In Range("A2:A" & lRow)
If cell.Value >= Date - 2 And cell.Value <= Date + 2 Then
cell.EntireRow.Copy Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
End If
Next cell
End If
Next ws
End Sub
This code is searching in just 1st column, I want it to search in the whole sheet. How do I do that ? Any suggestions ?