Hello all. I want to check if a column within a table has been completely populated with input from the user. If there is missing data input, the routine exits. I've tried to use the WorksheetFunction.CountA(rng) function, but I'm not getting any results. Do I need to insert a loop function instead? Any help with this is greatly appreciated.
Code:
Private Sub CheckCell() 'check to ensure all dates are entered
Dim iCell As Range
Dim LastRow As Long
Dim lstObj As ListObject
Dim ws1, ws2 As Worksheet
Set wb = ThisWorkbook
Set ws1 = wb.Sheets(1)
Set ws2 = wb.Sheets(2)
Set lstObj = ws1.ListObjects("Table")-1 'table contains header
LastRow = lstObj.Range.Rows.Count
Set iCell = ws1.Range("F2:F" & LastRow)
If WorksheetFunction.CountA(iCell) < iCell.Count Then
Exit Sub 'there are still stop dates unfilled so exit sub
Else
ws2.Range("D9").value = Now()
End If
Application.EnableEvents = True
End Sub
Last edited: