ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro to chose what to print (https://www.excelbanter.com/excel-discussion-misc-queries/48103-macro-chose-what-print.html)

John

Macro to chose what to print
 
This is what i have so far. Currently you have to enter a number 1-4. Is
there a possibility to have a check box next to the one(s) you want to print?
I hope this makes sense?


Title = "what do you want to print"
Config = vbOKCancel + vbQuestion
Ans = MsgBox(msg, Config, Title)
If Ans = vbOK Then
If Ans = vbCancel Then Exit Sub
Dim PReport As Variant
PReport = InputBox("Enter an Certificate (1-4) for the Variable CD to
Print", "Print Report", 1)
Select Case PReport
Case 1
Call PrintPEFVRCD1
Case 2
Call PrintPEFVRCD2
Case 3
Call PrintPEFVRCD3
Case 4
Call PrintPEFVRCD4
Case ""
MsgBox "User Cancelled"
Case Else
MsgBox "You must enter and interger" & Chr(10) & "between 1 and 4"
End Select
Else
'Do Something else
End If

Dave Peterson

Not if you're going to use an inputbox.

If you created a userform, you could do anything you want--it you only want to
let the user choose one, then option buttons might be a better choice than
checkboxes.

Debra Dalgleish has a small tutorial for working with userforms at:
http://contextures.com/xlUserForm01.html

John wrote:

This is what i have so far. Currently you have to enter a number 1-4. Is
there a possibility to have a check box next to the one(s) you want to print?
I hope this makes sense?

Title = "what do you want to print"
Config = vbOKCancel + vbQuestion
Ans = MsgBox(msg, Config, Title)
If Ans = vbOK Then
If Ans = vbCancel Then Exit Sub
Dim PReport As Variant
PReport = InputBox("Enter an Certificate (1-4) for the Variable CD to
Print", "Print Report", 1)
Select Case PReport
Case 1
Call PrintPEFVRCD1
Case 2
Call PrintPEFVRCD2
Case 3
Call PrintPEFVRCD3
Case 4
Call PrintPEFVRCD4
Case ""
MsgBox "User Cancelled"
Case Else
MsgBox "You must enter and interger" & Chr(10) & "between 1 and 4"
End Select
Else
'Do Something else
End If


--

Dave Peterson


All times are GMT +1. The time now is 11:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com