View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
JW[_2_] JW[_2_] is offline
external usenet poster
 
Posts: 638
Default Cells Left Blank

I need to see the rest of your code structure in order to tell you why
it isn't exiting the code? As for the range names, yes, just replace
the B9 with the name for that range.
Eric wrote:
JW,

Thank you this works but it says that cell b9 is empty and this is good now
let me through a twist into things.

What if I lable this cell would I just switch B9 for the cell name "Mix
Type". Also, when I hit okay after the msgbox tells me it's empty, it still
goes on to the next page even if the cell is blank.

Sounds like a miner fix.....

"JW" wrote:

To add more cirteria, just add more range addresses to the rangeArray.
Sub howAboutThis()
Dim rangeArray As Variant, r As Range
rangeArray = Array("B9", "B10", "B15")
For i = LBound(rangeArray) To UBound(rangeArray)
If IsEmpty(Range(rangeArray(i))) Then
MsgBox rangeArray(i) & " can not be blank"
Exit Sub
End If
Next i
'rest of your code here
End Sub

Eric wrote:
Hello all,

I am trying to make a macro that won't let you continue unless all the cells
on a particular sheet are filled in with information.

ie:
Before clicking the worksheet macro cells B9, B10, B15, etc. must contain
information. If cells B9 and B10 have info but not B15 the worksheet macro
should stop and give the message box that B15 isn't filled in.

I hope this makes sence to everyone.
Thank you in advance for all the help.

Eric