Print Macro Problem

  • Thread starter Thread starter access user
  • Start date Start date
A

access user

Hi

My print macro works if I run it from the sheet that I want to print, but if
I am on another sheet, it appears to do nothing. I actually want a button on
another sheet and want to print the sheet in question, without having to
select that sheet first. My macro is below:

Sub PrintAll()
With Sheets("CoverSheet")
For i = 1 To Range("D48")

Range("N1").Value = i
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

Next i
End With
End Sub

Any ideas?
tia
James
 
Dots, dots, dots...

Sub PrintAll()
With Sheets("CoverSheet")
For i = 1 To .Range("D48")
.Range("N1").Value = i
.PrintOut Copies:=1, Collate:=True
Next i
End With
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"access user"
wrote in message
Hi
My print macro works if I run it from the sheet that I want to print, but if
I am on another sheet, it appears to do nothing. I actually want a button on
another sheet and want to print the sheet in question, without having to
select that sheet first. My macro is below:

Sub PrintAll()
With Sheets("CoverSheet")
For i = 1 To Range("D48")

Range("N1").Value = i
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

Next i
End With
End Sub

Any ideas?
tia
James
 
I see the point Jim :-)

What do those dots mean? It works now but just curious as to why those dots
are so important.

thanks
James
 
Dots connect objects with their properties and methods.
With Sheets("CoverSheet")
Range("D48") 'is on the active sheet.
.Range("D48") 'is on Sheets("CoverSheet")
End With
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)




"access user"
wrote in message
I see the point Jim :-)

What do those dots mean? It works now but just curious as to why those dots
are so important.
thanks
James
 
Thanks Jim.
James

Jim Cone said:
Dots connect objects with their properties and methods.
With Sheets("CoverSheet")
Range("D48") 'is on the active sheet.
.Range("D48") 'is on Sheets("CoverSheet")
End With
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)




"access user"
wrote in message
I see the point Jim :-)

What do those dots mean? It works now but just curious as to why those dots
are so important.
thanks
James
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top