Empty cell stops macro 
Author Message
 Empty cell stops macro

Hello,

I would like to click a button to start a macro, but if certain cells are
empty, a message box appears stating that there is no data in those cells.
Clicking OK stops the macro.  (Only one cell needs to be empty to stop the
macro). If the targeted cells contain data, then the macro will run without
interruption.  Any help in solving this would be greatly appreciated.
Thanks.

dnlmiller



Sat, 04 Jun 2005 12:14:31 GMT  
 Empty cell stops macro
G'day

This is pretty primitive but should get you going.

Tony

Sub aaa()
 For Each ce In Selection
  If IsEmpty(ce) Then blanker = blanker & ce.Row & ", "
 Next ce
 If Len(blanker) > 0 Then MsgBox blanker: Exit Sub
 'processing if ok
 MsgBox "doingthings"
End Sub

Quote:
>-----Original Message-----
>Hello,

>I would like to click a button to start a macro, but if
certain cells are
>empty, a message box appears stating that there is no

data in those cells.
Quote:
>Clicking OK stops the macro.  (Only one cell needs to be
empty to stop the
>macro). If the targeted cells contain data, then the

macro will run without
Quote:
>interruption.  Any help in solving this would be greatly
appreciated.
>Thanks.

>dnlmiller

>.



Sat, 04 Jun 2005 12:42:06 GMT  
 Empty cell stops macro
Private Sub CommandButton1_Click()
Dim res as Variant
if Application.CountBlank(Range("A1,B9,C10,D3,A9")) > 0 then
  res = msgbox( "Missing Data, Ok to stop?",vbOkCancel )
  if res = vbOK then
    Exit Sub
  End if
End if
' remainder of your code.

although I think click vbOk to cancel and cancel to continue is a little
counterintuitive.

Regards,
Tom Ogilvy


Quote:
> Hello,

> I would like to click a button to start a macro, but if certain cells are
> empty, a message box appears stating that there is no data in those cells.
> Clicking OK stops the macro.  (Only one cell needs to be empty to stop the
> macro). If the targeted cells contain data, then the macro will run
without
> interruption.  Any help in solving this would be greatly appreciated.
> Thanks.

> dnlmiller



Sat, 04 Jun 2005 12:48:39 GMT  
 Empty cell stops macro
Thanks.  Just what I needed.


Quote:
> Private Sub CommandButton1_Click()
> Dim res as Variant
> if Application.CountBlank(Range("A1,B9,C10,D3,A9")) > 0 then
>   res = msgbox( "Missing Data, Ok to stop?",vbOkCancel )
>   if res = vbOK then
>     Exit Sub
>   End if
> End if
> ' remainder of your code.

> although I think click vbOk to cancel and cancel to continue is a little
> counterintuitive.

> Regards,
> Tom Ogilvy



> > Hello,

> > I would like to click a button to start a macro, but if certain cells
are
> > empty, a message box appears stating that there is no data in those
cells.
> > Clicking OK stops the macro.  (Only one cell needs to be empty to stop
the
> > macro). If the targeted cells contain data, then the macro will run
> without
> > interruption.  Any help in solving this would be greatly appreciated.
> > Thanks.

> > dnlmiller



Sun, 05 Jun 2005 13:05:01 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Displaying the 3rd cell from the last non-empty empty cell

2. Make a procedure stop running when will find the first empty cell (hyperlink problem)

3. If 1st cell is empty, I want data from 2nd cell to copy into 3rd cell

4. Empty Cell Fill Macro

5. Macro for Deleting Empty Cells

6. Macro for suppression of empty cells and not entire rows

7. how to select all non-empty cells in a vba macro

8. Setting Empty Cells Macro

9. Run Macro until cell is empty

10. Macro goto first empty cell


 
Powered by phpBB® Forum Software © phpBB Group