Hello, I have two questions, but they pertain to the same page. The rules do not state you cannot ask two questions, but I can see how that may be confusing, so perhaps it should be added(?).
The first one is to delete a row of cells to the left if one column has an older date than today. The cell "P1" has =Today() in it, but it does not seem to work. What do I have incorrect? Here is the code:
With Sheet8 'Delete older than 3 month cells in overnights
Set rng = Range("G2:G99")
For Each Cell In rng
If Cell < Cells(1, "P") Then
Cell.ClearContents
Cell.Offset(0, -1).ClearContents
Cell.Offset(0, -2).ClearContents
Cell.Offset(0, -3).ClearContents
Cell.Offset(0, -4).ClearContents
Cell.Offset(0, -5).ClearContents
Cell.Offset(0, -6).ClearContents
End If
Next Cell
End With
The second issue is with offsetting a cell if the name is found in column 1. I have no idea on how to do this without entering it on a userform first. The difficult part is that it is on two different pages. So if another cell that is in Cell.Row, 2 has O/N in the row in ws1 and has the same name in ws2 already, then I want it to go into the next column, which is 3. This needs to be done until it gets to column 6. These cells in the new columns need to have DateAdd("d", -1, Date) in them. Here is the code I already have.
With ThisWorkbook 'Overnight checklist copying
Set ws1 = .Sheets("Guest Management")
Set ws2 = .Sheets("Overnight Checklist")
End With
Set CheckRange = ws1.Range("G6:G38")
For Each Cell In CheckRange
If Cell.Value = "O/N" Then
emptyRow = ws2.Cells(Rows.Count, "A").End(xlUp).Row + 1
ws2.Cells(emptyRow, 1) = Cells(Cell.Row, 2).Value
ws2.Cells(emptyRow, 2) = DateAdd("d", -1, Date)
ws2.Cells(emptyRow, 7) = DateAdd("d", 90, Date)
End If
Next Cell
Here is what it looks like:
Untitled.jpg
With the dates being offset for Bob if there is another O/N.
Bookmarks