Hi,
Trying to get the row number of the current date on all worksheets of a workbook
The sheet2.Range("q1").Value is just the current date =Today()
Sub DATEFIND()
Dim lastrow As Integer
Dim ZeroLast As Date
Dim WS As Worksheet
ZeroLast = Sheet2.Range("q1").Value
For Each WS In Sheets
With WS
lastrow = WS.Cells.Find(ZeroLast, searchorder:=xlByRows, searchdirection:=xlPrevious).Row
WS.Range("C1").Value = lastrow
WS.Range("e1").Value = WS.Name
End With
Next WS
End Sub
The error lies in the ws.cells but I don't know how to get past this.
Please help if you can.
Paul
Trying to get the row number of the current date on all worksheets of a workbook
The sheet2.Range("q1").Value is just the current date =Today()
Sub DATEFIND()
Dim lastrow As Integer
Dim ZeroLast As Date
Dim WS As Worksheet
ZeroLast = Sheet2.Range("q1").Value
For Each WS In Sheets
With WS
lastrow = WS.Cells.Find(ZeroLast, searchorder:=xlByRows, searchdirection:=xlPrevious).Row
WS.Range("C1").Value = lastrow
WS.Range("e1").Value = WS.Name
End With
Next WS
End Sub
The error lies in the ws.cells but I don't know how to get past this.
Please help if you can.
Paul