我有一个 Sud,它告诉我一列是否有空白单元格。
如果它是空白的,有没有办法也得到单元格的位置,可能有数千行,可能有一两个空白单元格,即使你知道它在那里也很容易错过。
谢谢
Sub CountBlankCellsComments()
Dim Lastrow As Long
Sheets("Comments").Select
With Sheets("Comments")
Lastrow = .Range("A" & .Rows.Count).End(xlUp).Row
End With
If WorksheetFunction.CountBlank(Range("A2:E" & Lastrow)) = 0 Then
MsgBox "There Are (0) Blank Cells For ""Comments"" Sheet"
Else
MsgBox "For Comments Sheet There are:" & vbCrLf & vbLf & _
"(" & WorksheetFunction.CountBlank(Range("A2:A" & Lastrow)) & ") Blank Cells in Column A" & vbCrLf & vbLf & _
"(" & WorksheetFunction.CountBlank(Range("B2:B" & Lastrow)) & ") Blank Cells in Column B" & vbCrLf & vbLf & _
"(" & WorksheetFunction.CountBlank(Range("C2:C" & Lastrow)) & ") Blank Cells in Column C" & vbCrLf & vbLf & _
"(" & WorksheetFunction.CountBlank(Range("D2:D" & Lastrow)) & ") Blank Cells in Column D" & vbCrLf & vbLf & _
"(" & WorksheetFunction.CountBlank(Range("E2:E" & Lastrow)) & ") Blank Cells in Column E"
End If
End Sub