![]() |
Help with Message Box Please
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 |
Help with Message Box Please
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 : 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 :- "x" Combinations That Meet The Criteria You Specified, Do You Want To Print Them?. Thanks in Advance Paul |
Help with Message Box Please
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 "keepITcool" wrote in message ... 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 : 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 :- "x" Combinations That Meet The Criteria You Specified, Do You Want To Print Them?. Thanks in Advance Paul |
Help with Message Box Please
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 "Paul Black" wrote in message ... 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 "keepITcool" wrote in message ... 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 : 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 :- "x" Combinations That Meet The Criteria You Specified, Do You Want To Print Them?. Thanks in Advance Paul |
All times are GMT +1. The time now is 10:14 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com