Agatha1226
New Member
- Joined
- Oct 18, 2016
- Messages
- 10
Hi,
I have the following code and would like to get the week number based on the date on column E. I tried to run the code but nothing happens. Basically, it checks each cell in column S if it is blank. If the cell is blank, it should get the corresponding week number based on the date in column E. Can anyone check and correct?
I have the following code and would like to get the week number based on the date on column E. I tried to run the code but nothing happens. Basically, it checks each cell in column S if it is blank. If the cell is blank, it should get the corresponding week number based on the date in column E. Can anyone check and correct?
Code:
Sub CleanUp()
Dim lRow As Long
'Dim lCol As Long
Dim i As Long
lRow = Cells(Rows.Count, 1).End(xlUp).Row
'lCol = Cells(1, Columns.Count).End(xlToLeft).Column
For i = 4 To lRow
If Cells(i, 19) <> "" Then
Cells(i, 19).Value = Application.WorksheetFunction.WeekNum(Cells(i, 5))
Else
Exit For
End If
Next i
End Sub