Hello,
I'm having trouble with something that seems pretty straight forward.
I have a worksheet with Dates and Blank cells in column A and would like to put "Open" if column A has a Date and "Closed" if column A has a Blank in column B.
I'm using the following code but am getting a 400 error.
Any help or suggestions would be appreciated.
Thanks.
I'm having trouble with something that seems pretty straight forward.
I have a worksheet with Dates and Blank cells in column A and would like to put "Open" if column A has a Date and "Closed" if column A has a Blank in column B.
I'm using the following code but am getting a 400 error.
VBA Code:
Sub openclose()
Dim rng As Range
Dim i As Long
'Set the range in column A you want to loop through
Set rng = Range("Z1:Z" & LastRow2)
For Each cell In rng
'test if cell is empty
If cell.Value <> "" Then
'write to adjacent cell
cell.Offset(0, -1).Value = "Closed"
Else
cell.Offset(0, -1).Value = "Open"
End If
Next
End Sub
Any help or suggestions would be appreciated.
Thanks.