Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,670
Default Cells Left Blank

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 638
Default Cells Left Blank

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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,670
Default Cells Left Blank

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



  #4   Report Post  
Posted to microsoft.public.excel.programming
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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Display error msg when cells left blank Jas Excel Programming 5 May 16th 07 07:50 PM
left padding + blank Alex Excel Programming 6 January 5th 06 10:23 PM
Validating cells left blank chris100[_42_] Excel Programming 4 December 4th 05 05:39 PM
counting from left to right and stopping when blank harpscardiff Excel Discussion (Misc queries) 6 August 19th 05 07:34 PM


All times are GMT +1. The time now is 10:14 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"