#1   Report Post  
John
 
Posts: n/a
Default Macro within Macro

I got help from a user the other day that helped me create a macro that will
ask you what worksheet to print. Now i was wondering if i could go a step
further. Instead of typing in the worksheet you want to print (See Below) I
want to know if it can come up with a list and you can choose which one to
print. Below is a portion of the current macro that i have.

Title = "PRINT SCREEN QUESTION"
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 Account Number (1-4) for the Data Input
sheet to Print", "Print Report", 1)
Select Case PReport
Case 1
Call Print1
Case 2
Call Print2
Case 3
Call Print3
Case 4
Call Print4
Case ""
MsgBox "User Cancelled"
Case Else
MsgBox "You must enter and Integer" & Chr(10) & "Between 1 and 4"
End Select
  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

You might want to try the technique in this previous posting
http://tinyurl.com/cpg3m

Just change
ActiveWorkbook.Worksheets(cb.Caption).Select

to
ActiveWorkbook.Worksheets(cb.Caption).Print

to print them

--

HTH

RP
(remove nothere from the email address if mailing direct)


"John" wrote in message
...
I got help from a user the other day that helped me create a macro that

will
ask you what worksheet to print. Now i was wondering if i could go a step
further. Instead of typing in the worksheet you want to print (See Below)

I
want to know if it can come up with a list and you can choose which one to
print. Below is a portion of the current macro that i have.

Title = "PRINT SCREEN QUESTION"
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 Account Number (1-4) for the Data Input
sheet to Print", "Print Report", 1)
Select Case PReport
Case 1
Call Print1
Case 2
Call Print2
Case 3
Call Print3
Case 4
Call Print4
Case ""
MsgBox "User Cancelled"
Case Else
MsgBox "You must enter and Integer" & Chr(10) & "Between 1 and 4"
End Select



  #3   Report Post  
John
 
Posts: n/a
Default

Bob

I guess i dont see where i would change what you suggested. You said change
ActiveWorkbook.activeworksheets(cb.Caption).Select
To
Activeworkbook.activeworksheets(cb.Caption).Print

Where would i put that in my formula?


"Bob Phillips" wrote:

You might want to try the technique in this previous posting
http://tinyurl.com/cpg3m

Just change
ActiveWorkbook.Worksheets(cb.Caption).Select

to
ActiveWorkbook.Worksheets(cb.Caption).Print

to print them

--

HTH

RP
(remove nothere from the email address if mailing direct)


"John" wrote in message
...
I got help from a user the other day that helped me create a macro that

will
ask you what worksheet to print. Now i was wondering if i could go a step
further. Instead of typing in the worksheet you want to print (See Below)

I
want to know if it can come up with a list and you can choose which one to
print. Below is a portion of the current macro that i have.

Title = "PRINT SCREEN QUESTION"
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 Account Number (1-4) for the Data Input
sheet to Print", "Print Report", 1)
Select Case PReport
Case 1
Call Print1
Case 2
Call Print2
Case 3
Call Print3
Case 4
Call Print4
Case ""
MsgBox "User Cancelled"
Case Else
MsgBox "You must enter and Integer" & Chr(10) & "Between 1 and 4"
End Select




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Make Alignment options under format cells available as shortcut dforrest Excel Discussion (Misc queries) 1 July 14th 05 10:58 PM
Help with macro looping and color query function kevinm Excel Discussion (Misc queries) 10 May 26th 05 01:25 AM
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM
Date macro Hiking Excel Discussion (Misc queries) 9 February 3rd 05 12:40 AM
Macro and If Statement SATB Excel Discussion (Misc queries) 2 December 3rd 04 04:46 PM


All times are GMT +1. The time now is 02:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"