I need one help in the excel.I have a worksheet which contains 10 rows and 7 columns . If all columns are filled ,then I am putting "ok" in column 8 otherwise Data incomplete". It is working perfectly fine . But the problem is when I leave other column blank (B, C,D & E ) except column number A & B (they are filled). it is still printing "OK" but it should be "Data Incomplete" . Please help me how should I implement this logic here .
lastrow = sheet1.Range("A" & Rows.Count).End(xlUp).Row For rownum = 1 To lastrow
For colnum = 1 To 7
If IsEmpty(Cells(rownum, colnum)) Then '<== To Check for Empty Cells
Cells(rownum, 8) = "Data Incomplete" '<== To Enter value if empty cell found
Cells(rownum, colnum).Interior.ColorIndex = 3
MsgBox "Please fill the column highlighted by Red"
Else
Cells(rownum, 8) = "OK"
End If
Next colnum
Next rownum
MsgBox
of course). Is VBA a necessity? If so,WorksheetFunction.CountBlank
, orWorksheetFunction.CountA
, may be helpful here. In any case, there is no need to loop over every individual cell. – BigBen