View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Printing Worksheets thru VBA

Something like this

If Activesheet.Range("A3") < "" Then
Worksheets(3).Activate
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
ElseIf Activesheet.Range("A2") < "" Then
Worksheets(2).Activate
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
ElseIf Activesheet.Range("A1") < "" Then
Worksheets(1).Activate
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End If

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"abxy " wrote in message
...
Hi all,
I'm creating a UserForm, and I'm trying to code a command button that
will print a sheet from another workbook.

I'm wondering though, what code can I add so that if cell A1 has data
in it, it will print sheet1 of the other workbook.

If A2 has data in it, it will print sheet2 of the other workbook, but
not sheet1, despite the fact that A1 has data in it.

If A3 has data in it, it will print sheet3 of the other workbook, but
not sheet1 or sheet2 despite the fact that they have data in them. and
so on...

In a nutshell, I just want to print the corresponding sheet in the
other workbook for the last cell of data only in column A...if that
makes sense.

Thanks in Advance for all your help.


---
Message posted from http://www.ExcelForum.com/