Help with Message Box Please

  • Thread starter Thread starter Paul Black
  • Start date Start date
P

Paul Black

Hi Everyone,

I have a Program that I Wrote Directly into a Module that Runs and
Lists Combinations. It Cycles through the Combinations ( Taking out
those that I Do Not Need ) and then Prints them out Starting in Cell
"A1" of the Active WorkSheet.
What I would like it to do is to Tell me How Many Combinations there
are to be Printed, and Give me the Option of Printing Them to the
Active Sheet Or NOT.
I Managed to get a Message Box that Just Gave me the Total
Combinations BUT it Still Printed them to the Active Sheet.

I have Already Tried in Different Parts of the Code :-
Dim Count As Long
Count = 0
Count = Count + 1
MsgBox Count

I Know I Need to use :-
vbYesNoCancel
Somehow, but I Do Not know How to.

I Would Ideally Like the Message Box to Say :-
There Are "x" Combinations That Meet The Criteria You Specified, Do
You Want To Print Them?.

Thanks in Advance
Paul
 
Paul, this would be the basic construct..

note that when the msgbox must return a result, it's arguments must
be in brackets.

if vbyes = Msgbox("There Are " count & "combinations!" & _
vbnewline & "Print 'm? " ,vbYesNo) then
'do it
else
Msgbox "Why dit you run it then?"
endif


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Paul Black wrote :
 
Thanks keepITcool for the Response,

Unfortunately I keep getting an error on :-
if vbyes = Msgbox("There Are " count & "combinations!" & _
vbnewline & "Print 'm? " ,vbYesNo) then
Do you have any suggestions please?.

Thanks very much
Paul
 
Try the following. I think you were missing the & between "There Are " and
Count.

If vbYes = MsgBox("There Are " & Count & " combinations!" & _
vbNewLine & "Print? ", vbYesNo) Then


--
Michael J. Malinsky
Pittsburgh, PA

"I am a bear of very little brain, and long
words bother me." -- AA Milne, Winnie the Pooh
 

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