Checking for non blank cells in named range

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a range, let's call it myRange that's cells B22:B24 in my worksheet.
I need to check that these cells are all not blank before doing something
else. I'm not sure how to write the code to check that all are non-blank.
Any suggestions?

Thanks
 
Here you go

Sub FindBlank()
Dim MyRange, mcell As Range
'Set your range to whatever you want
Set MyRange = Range("B22:B24")
For Each mcell In MyRange
If mcell.Value = Empty Then
MsgBox "You have blank cells in Range - " _
& MyRange.Address(False, False)
Exit Sub
End If
Next
MsgBox "You have NO blank cells in Range - " _
& MyRange.Address(False, False)
' the rest of your code here
End Sub


Sandy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top