Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 84
Default Help with joining two macros together

Hi, I would like to join these together, but have the second macro
only apply to the sheets
monback,tuesback,wedback,thursback,fridback,satbac k as they are the
only sheets that may have two pages to print. The print button will be
on a sheet called starta.

Thanks code below....

Sub PrintMontoFrid()
'Print out End Of Week Stats
Application.ScreenUpdating = False
Sheets(Array("monday", "monback", "tuesday", "tuesback",
"wednesday", "wedback", "thursday", "thurback", "friday", "fridback",
"saturday", "satback", "weekly")).Select
ActiveWindow.SelectedSheets.PrintOut copies:=1
Sheets("starta").Select
Application.ScreenUpdating = True
End Sub


Sub Print1or2pages()
If Range("total1") 0 Then ActiveSheet.PrintOut From:=1, To:=1
If Range("total2") 0 Then ActiveSheet.PrintOut From:=2, To:=2
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 84
Default Help with joining two macros together

Don it errors out but could you explain what each w in my array
means???

This is the error
w.print
runtime error 424 object required


Thanks so far

On Feb 3, 12:13 pm, "Don Guillett" wrote:
untested but try

Sub PrintMontoFrid()
'Print out End Of Week Stats
Application.ScreenUpdating = False
myarray=Array("monday", "monback", "tuesday", "tuesback",
"wednesday", "wedback", "thursday", "thurback", "friday", "fridback",
"saturday", "satback", "weekly")
for each w in myarray
w.print
next w
Application.ScreenUpdating = True
End Sub

--
Don Guillett
SalesAid Software
"pano" wrote in message

oups.com...



Hi, I would like to join these together, but have the second macro
only apply to the sheets
monback,tuesback,wedback,thursback,fridback,satbac k as they are the
only sheets that may have two pages to print. The print button will be
on a sheet called starta.


Thanks code below....


Sub PrintMontoFrid()
'Print out End Of Week Stats
Application.ScreenUpdating = False
Sheets(Array("monday", "monback", "tuesday", "tuesback",
"wednesday", "wedback", "thursday", "thurback", "friday", "fridback",
"saturday", "satback", "weekly")).Select
ActiveWindow.SelectedSheets.PrintOut copies:=1
Sheets("starta").Select
Application.ScreenUpdating = True
End Sub


Sub Print1or2pages()
If Range("total1") 0 Then ActiveSheet.PrintOut From:=1, To:=1
If Range("total2") 0 Then ActiveSheet.PrintOut From:=2, To:=2
End Sub- Hide quoted text -


- Show quoted text -



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,124
Default Help with joining two macros together

It should have been w.printout but that's not the only problem. I just
tested this
The for each is a looping macro. Look in the vba help index for LOOP and go
from there.
It might be easier to exclude the undesired sheets instead.

Sub PrintMontoFrid()
'Print out End Of Week Stats
Application.ScreenUpdating = False
myarray = Array("monday", "monback", "tuesday", "tuesback", _
"wednesday", "wedback", "thursday", "thurback", "friday", _
"fridback", "saturday", "satback", "weekly")
For Each w In myarray
'MsgBox w
'Sheets(w).PrintPreview
Sheets(w).PrintOut
Next w
Application.ScreenUpdating = True
End Sub
--
Don Guillett
SalesAid Software

"pano" wrote in message
ps.com...
Don it errors out but could you explain what each w in my array
means???

This is the error
w.print
runtime error 424 object required


Thanks so far

On Feb 3, 12:13 pm, "Don Guillett" wrote:
untested but try

Sub PrintMontoFrid()
'Print out End Of Week Stats
Application.ScreenUpdating = False
myarray=Array("monday", "monback", "tuesday", "tuesback",
"wednesday", "wedback", "thursday", "thurback", "friday", "fridback",
"saturday", "satback", "weekly")
for each w in myarray
w.print
next w
Application.ScreenUpdating = True
End Sub

--
Don Guillett
SalesAid Software
"pano" wrote in message

oups.com...



Hi, I would like to join these together, but have the second macro
only apply to the sheets
monback,tuesback,wedback,thursback,fridback,satbac k as they are the
only sheets that may have two pages to print. The print button will be
on a sheet called starta.


Thanks code below....


Sub PrintMontoFrid()
'Print out End Of Week Stats
Application.ScreenUpdating = False
Sheets(Array("monday", "monback", "tuesday", "tuesback",
"wednesday", "wedback", "thursday", "thurback", "friday", "fridback",
"saturday", "satback", "weekly")).Select
ActiveWindow.SelectedSheets.PrintOut copies:=1
Sheets("starta").Select
Application.ScreenUpdating = True
End Sub


Sub Print1or2pages()
If Range("total1") 0 Then ActiveSheet.PrintOut From:=1, To:=1
If Range("total2") 0 Then ActiveSheet.PrintOut From:=2, To:=2
End Sub- Hide quoted text -


- Show quoted text -





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
Macros Don't Show On Commands List and 'Normal.dot' SV Excel Worksheet Functions 3 December 13th 06 07:23 PM
Deleting phantom macros [email protected] Setting up and Configuration of Excel 2 September 8th 06 11:47 AM
Hide Macro's in Toolbar / Macro's list sparx Excel Discussion (Misc queries) 2 May 6th 06 08:53 PM
how do I run excel 4.0 macros on excel 2000 RodolfoDallas Excel Discussion (Misc queries) 1 March 12th 06 03:14 AM
Macros for find and replace and then joining columns BobbyCochran Excel Discussion (Misc queries) 0 May 20th 05 01:06 AM


All times are GMT +1. The time now is 10:13 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"