ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   print sheets from a range with names (https://www.excelbanter.com/excel-programming/379173-print-sheets-range-names.html)

cbm

print sheets from a range with names
 
I´ve got a list of certain sheet name´s and i need a command button
to print or preview only that sheets.
Example:

a1 Sheet3
a2 Sheet7
a3 Sheet10
....


Any idea???

Thanks a lot


Don Guillett

print sheets from a range with names
 
Sub printsheets()
With Worksheets("sheet1")
Set rng = .Range("A2:A5")
End With
For Each c In rng
Set sh = Worksheets(c.Value)
sh.PrintPreview
Next
End Sub


--
Don Guillett
SalesAid Software

"cbm" wrote in message
ups.com...
I´ve got a list of certain sheet name´s and i need a command button
to print or preview only that sheets.
Example:

a1 Sheet3
a2 Sheet7
a3 Sheet10
....


Any idea???

Thanks a lot



Don Guillett

print sheets from a range with names
 
Or shorter

Sub doshts()
For Each c In Sheets("sheet1").Range("a2:a3")
Worksheets(c.Value).PrintPreview
Next c
End Sub
--
Don Guillett
SalesAid Software

"cbm" wrote in message
ups.com...
I´ve got a list of certain sheet name´s and i need a command button
to print or preview only that sheets.
Example:

a1 Sheet3
a2 Sheet7
a3 Sheet10
....


Any idea???

Thanks a lot



cbm

print sheets from a range with names
 
THANKS A LOT, DON!!! Great job.
WORKS PERFECT.

As names came from a formula, i addapted it as:

Private Sub CommandButton2_Click()
Range("FJ1").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Range("FK1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Selection.Sort Key1:=Range("FK1"), Order1:=xlDescending,
Header:=xlGuess _
, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("d1021").Select
For Each c In Sheets("Est").Range("fk1:fk1000")
On Error Resume Next
Worksheets(c.Value).PrintPreview
Next c

End Sub



Don Guillett ha escrito:

Or shorter

Sub doshts()
For Each c In Sheets("sheet1").Range("a2:a3")
Worksheets(c.Value).PrintPreview
Next c
End Sub
--
Don Guillett
SalesAid Software

"cbm" wrote in message
ups.com...
I´ve got a list of certain sheet name´s and i need a command button
to print or preview only that sheets.
Example:

a1 Sheet3
a2 Sheet7
a3 Sheet10
...


Any idea???

Thanks a lot



Don Guillett

print sheets from a range with names
 
Glad to help

--
Don Guillett
SalesAid Software

"cbm" wrote in message
ups.com...
THANKS A LOT, DON!!! Great job.
WORKS PERFECT.

As names came from a formula, i addapted it as:

Private Sub CommandButton2_Click()
Range("FJ1").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Range("FK1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Selection.Sort Key1:=Range("FK1"), Order1:=xlDescending,
Header:=xlGuess _
, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("d1021").Select
For Each c In Sheets("Est").Range("fk1:fk1000")
On Error Resume Next
Worksheets(c.Value).PrintPreview
Next c

End Sub



Don Guillett ha escrito:

Or shorter

Sub doshts()
For Each c In Sheets("sheet1").Range("a2:a3")
Worksheets(c.Value).PrintPreview
Next c
End Sub
--
Don Guillett
SalesAid Software

"cbm" wrote in message
ups.com...
I´ve got a list of certain sheet name´s and i need a command button
to print or preview only that sheets.
Example:

a1 Sheet3
a2 Sheet7
a3 Sheet10
...


Any idea???

Thanks a lot





All times are GMT +1. The time now is 05:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com