is there an empty cell in the range from A to R?
The logic is to check if the total number of cells matches the full filled cells.
Like this?
Sub Sample()
If test = False Then
MsgBox "Range A to R has empty cells"
Else
MsgBox "No Empty Cells"
End If
End Sub
Private Function test() As Boolean
Dim lRow As Long
Dim ws As Worksheet
Set ws = ActiveWorkbook.Sheets("pppdp")
With ws
If Application.WorksheetFunction.CountA(.Cells) <> 0 Then
lRow = .Range("A:R").Find(What:="*", _
After:=.Range("A1"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
Else
lRow = 1
End If
test = Application.WorksheetFunction.CountA(.Range("A1:R" & lRow)) _
= .Range("A1:R" & lRow).Cells.Count
End With
End Function

source
share