Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA - Printing filtered records

Hi,
I have a worksheet called "Barcodes" that collects long lists of
barcode entries. To reduce paper use for printing, I have used the
"copy picture" function to create picture links to a worksheet called
"Print" so that multiple columns can be printed on one page. The
problem is the printout contains the maximum possible pages defined in
the print area and not just the required pages. I have attached a
screen shot as I'm not sure I have explained this properly The macro is
as outlined below.
Thankyou for your time,
jvine

-----------------------------------------------------------------------------
Sub Sort_Delete_Print()
'
' Sort_Delete_Print Macro
'
' This section sorts the data
'

YesNo = MsgBox("This will print your current list of barcodes." &
Chr(13) & "Do you want to continue?", vbYesNo + vbCritical, "Caution")
Select Case YesNo
Case vbYes

Application.ScreenUpdating = False

'
' This section sorts the data
'

Sheets("Barcodes").Select
Range("B1:C1001").Select
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

'
' This section deletes duplicate data
'

Sheets("Barcodes").Select
Range("B2:B1001").AdvancedFilter Action:=xlFilterInPlace,
CriteriaRange:= _
Range("B2:B1001"), Unique:=True

'
' This section hides blank cells then prints the data
'

Range("B2:B1001").Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.EntireRow.Hidden = True
Sheets("Print").Visible = True
Sheets("Print").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Print").Select
ActiveWindow.SelectedSheets.Visible = False

Sheets("Barcodes").Select
ActiveSheet.ShowAllData
Range("B2").Select

Application.ScreenUpdating = True

MsgBox "Please collect your list of barcodes from the printer.",
vbInformation, "Human Immunology Barcode Form Checks"

Case vbNo

MsgBox "Action cancelled", vbInformation, "Human Immunology Barcode
Form Checks"

End Select


End Sub

---------------------------------------------------------------

Attachment filename: screenshot.gif
Download attachment: http://www.excelforum.com/attachment.php?postid=562266
---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Excel VBA - Printing filtered records

I'm confused but it appears that you are filtering one page and printing
another. Also, most (if not all) of your selections can be avoided.

--
Don Guillett
SalesAid Software

"jvine " wrote in message
...
Hi,
I have a worksheet called "Barcodes" that collects long lists of
barcode entries. To reduce paper use for printing, I have used the
"copy picture" function to create picture links to a worksheet called
"Print" so that multiple columns can be printed on one page. The
problem is the printout contains the maximum possible pages defined in
the print area and not just the required pages. I have attached a
screen shot as I'm not sure I have explained this properly The macro is
as outlined below.
Thankyou for your time,
jvine

--------------------------------------------------------------------------

---
Sub Sort_Delete_Print()
'
' Sort_Delete_Print Macro
'
' This section sorts the data
'

YesNo = MsgBox("This will print your current list of barcodes." &
Chr(13) & "Do you want to continue?", vbYesNo + vbCritical, "Caution")
Select Case YesNo
Case vbYes

Application.ScreenUpdating = False

'
' This section sorts the data
'

Sheets("Barcodes").Select
Range("B1:C1001").Select
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

'
' This section deletes duplicate data
'

Sheets("Barcodes").Select
Range("B2:B1001").AdvancedFilter Action:=xlFilterInPlace,
CriteriaRange:= _
Range("B2:B1001"), Unique:=True

'
' This section hides blank cells then prints the data
'

Range("B2:B1001").Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.EntireRow.Hidden = True
Sheets("Print").Visible = True
Sheets("Print").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Print").Select
ActiveWindow.SelectedSheets.Visible = False

Sheets("Barcodes").Select
ActiveSheet.ShowAllData
Range("B2").Select

Application.ScreenUpdating = True

MsgBox "Please collect your list of barcodes from the printer.",
vbInformation, "Human Immunology Barcode Form Checks"

Case vbNo

MsgBox "Action cancelled", vbInformation, "Human Immunology Barcode
Form Checks"

End Select


End Sub

---------------------------------------------------------------

Attachment filename: screenshot.gif
Download attachment:

http://www.excelforum.com/attachment.php?postid=562266
---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Excel VBA - Printing filtered records

jvine,

Print from the "Barcodes" sheet. Set the print area to be the same as that
area where you are hiding rows. Once you've hidden rows, they won't print,
and you'll only get the unhidden rows.

HTH,
Bernie
MS Excel MVP

"jvine " wrote in message
...
Hi,
I have a worksheet called "Barcodes" that collects long lists of
barcode entries. To reduce paper use for printing, I have used the
"copy picture" function to create picture links to a worksheet called
"Print" so that multiple columns can be printed on one page. The
problem is the printout contains the maximum possible pages defined in
the print area and not just the required pages. I have attached a
screen shot as I'm not sure I have explained this properly The macro is
as outlined below.
Thankyou for your time,
jvine

--------------------------------------------------------------------------

---
Sub Sort_Delete_Print()
'
' Sort_Delete_Print Macro
'
' This section sorts the data
'

YesNo = MsgBox("This will print your current list of barcodes." &
Chr(13) & "Do you want to continue?", vbYesNo + vbCritical, "Caution")
Select Case YesNo
Case vbYes

Application.ScreenUpdating = False

'
' This section sorts the data
'

Sheets("Barcodes").Select
Range("B1:C1001").Select
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

'
' This section deletes duplicate data
'

Sheets("Barcodes").Select
Range("B2:B1001").AdvancedFilter Action:=xlFilterInPlace,
CriteriaRange:= _
Range("B2:B1001"), Unique:=True

'
' This section hides blank cells then prints the data
'

Range("B2:B1001").Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.EntireRow.Hidden = True
Sheets("Print").Visible = True
Sheets("Print").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Print").Select
ActiveWindow.SelectedSheets.Visible = False

Sheets("Barcodes").Select
ActiveSheet.ShowAllData
Range("B2").Select

Application.ScreenUpdating = True

MsgBox "Please collect your list of barcodes from the printer.",
vbInformation, "Human Immunology Barcode Form Checks"

Case vbNo

MsgBox "Action cancelled", vbInformation, "Human Immunology Barcode
Form Checks"

End Select


End Sub

---------------------------------------------------------------

Attachment filename: screenshot.gif
Download attachment:

http://www.excelforum.com/attachment.php?postid=562266
---
Message posted from http://www.ExcelForum.com/



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
Delete the filtered records VCKW Excel Discussion (Misc queries) 4 October 15th 07 03:39 PM
Printing Filtered Excel Worksheets widman Excel Discussion (Misc queries) 0 November 29th 06 03:58 PM
accumulate filtered records from several sheets to one CaptDunsull Excel Discussion (Misc queries) 0 December 30th 05 03:03 PM
returning value from filtered records JulieD Excel Discussion (Misc queries) 3 April 29th 05 03:39 PM
how do I see more than 1000 records filtered ml Excel Discussion (Misc queries) 1 April 13th 05 08:47 PM


All times are GMT +1. The time now is 04:46 PM.

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

About Us

"It's about Microsoft Excel"