Home |
Search |
Today's Posts |
#1
|
|||
|
|||
VBA Question
I have a little problem. I need to write a VBA. I have a button that will
print four letters that are located in a seperate worksheet. Currently I have a macro that goes to that worksheet and prints all four. But I want to have a pop-up that will ask Which letter they want to print. I believe that this is possible, but i need some help developing it. Any help would be appreciated. Thank you |
#2
|
|||
|
|||
One way would be to record 4 different macros - one to print each
letter, in my example I have called them Print1, Print2, etc. Then attach the macro below to your print button: Sub Pintit() Dim PReport As Variant PReport = InputBox("Enter 1 to 4 for report to print" _ , "Print Report", 1) Select Case PReport Case 1 Call Print1 Case 2 Call Print2 Case 3 Call Print2 Case 4 Call Print4 Case "" MsgBox "User Cancelled" Case Else MsgBox "You must enter and integer" & Chr(10) _ & "between 1 and 4" End Select End Sub Hope this helps Rowan John wrote: I have a little problem. I need to write a VBA. I have a button that will print four letters that are located in a seperate worksheet. Currently I have a macro that goes to that worksheet and prints all four. But I want to have a pop-up that will ask Which letter they want to print. I believe that this is possible, but i need some help developing it. Any help would be appreciated. Thank you |
#3
|
|||
|
|||
Rowan
Thank you very much. It worked Perfectly. Thank very much for you help "Rowan" wrote: One way would be to record 4 different macros - one to print each letter, in my example I have called them Print1, Print2, etc. Then attach the macro below to your print button: Sub Pintit() Dim PReport As Variant PReport = InputBox("Enter 1 to 4 for report to print" _ , "Print Report", 1) Select Case PReport Case 1 Call Print1 Case 2 Call Print2 Case 3 Call Print2 Case 4 Call Print4 Case "" MsgBox "User Cancelled" Case Else MsgBox "You must enter and integer" & Chr(10) _ & "between 1 and 4" End Select End Sub Hope this helps Rowan John wrote: I have a little problem. I need to write a VBA. I have a button that will print four letters that are located in a seperate worksheet. Currently I have a macro that goes to that worksheet and prints all four. But I want to have a pop-up that will ask Which letter they want to print. I believe that this is possible, but i need some help developing it. Any help would be appreciated. Thank you |
#4
|
|||
|
|||
You're welcome.
"John" wrote: Rowan Thank you very much. It worked Perfectly. Thank very much for you help "Rowan" wrote: One way would be to record 4 different macros - one to print each letter, in my example I have called them Print1, Print2, etc. Then attach the macro below to your print button: Sub Pintit() Dim PReport As Variant PReport = InputBox("Enter 1 to 4 for report to print" _ , "Print Report", 1) Select Case PReport Case 1 Call Print1 Case 2 Call Print2 Case 3 Call Print2 Case 4 Call Print4 Case "" MsgBox "User Cancelled" Case Else MsgBox "You must enter and integer" & Chr(10) _ & "between 1 and 4" End Select End Sub Hope this helps Rowan John wrote: I have a little problem. I need to write a VBA. I have a button that will print four letters that are located in a seperate worksheet. Currently I have a macro that goes to that worksheet and prints all four. But I want to have a pop-up that will ask Which letter they want to print. I believe that this is possible, but i need some help developing it. Any help would be appreciated. Thank you |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I find and replace a question mark in Excel? | Excel Discussion (Misc queries) | |||
Newbie With A Question | Excel Worksheet Functions | |||
Anybody Help with previous question | Excel Discussion (Misc queries) | |||
Hints And Tips For New Posters In The Excel Newsgroups | Excel Worksheet Functions | |||
An easy macro question and one I believe to be a little more diffi | Excel Worksheet Functions |