Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
printing a range that changes all the time
Hi experts,
I have data starting from A1 to M... I would like to count the rows to print based on the input in column B !!! I have the following code for printing a range. Dim rngprint As Range Sheets("Outputdlnrs").Select Set rngprint = Range("A1", Range("A1").End(xlDown).Address) ActiveSheet.PageSetup.PrintArea = rngprint.Address Selection.PrintPreview This does not work because only A1 is selected each time. Does anybody have the right formula ? Thanks, Pierre -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200510/1 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
printing a range that changes all the time
Try this Pierre
Sub test() Dim rngprint As Range Dim lr As Long Sheets("Outputdlnrs").Select lr = Range("B" & Rows.Count).End(xlUp).Row Set rngprint = Range("A1:M" & lr) rngprint.PrintPreview End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "Pierre via OfficeKB.com" <u13950@uwe wrote in message news:566bc8945ed14@uwe... Hi experts, I have data starting from A1 to M... I would like to count the rows to print based on the input in column B !!! I have the following code for printing a range. Dim rngprint As Range Sheets("Outputdlnrs").Select Set rngprint = Range("A1", Range("A1").End(xlDown).Address) ActiveSheet.PageSetup.PrintArea = rngprint.Address Selection.PrintPreview This does not work because only A1 is selected each time. Does anybody have the right formula ? Thanks, Pierre -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200510/1 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
printing a range that changes all the time
Hi Ron,
Thanks you for your input. I checked your site and several questions asked in this forum about printing in which your name came up each time ! Your code works fine but... in column B there are some 1000 lines with a formula in them. only a certain number of cells have actual data in them. So it would be nice if your formula would only count the rows where the cell < "" Any ideas? thanks, Pierre Ron de Bruin wrote: Try this Pierre Sub test() Dim rngprint As Range Dim lr As Long Sheets("Outputdlnrs").Select lr = Range("B" & Rows.Count).End(xlUp).Row Set rngprint = Range("A1:M" & lr) rngprint.PrintPreview End Sub Hi experts, [quoted text clipped - 15 lines] Thanks, Pierre -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200510/1 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
printing a range that changes all the time
Hi Pierre
Why don't you filter with autofilter on nonblanks in column B and print -- Regards Ron de Bruin http://www.rondebruin.nl "Pierre via OfficeKB.com" <u13950@uwe wrote in message news:566c60320fbbe@uwe... Hi Ron, Thanks you for your input. I checked your site and several questions asked in this forum about printing in which your name came up each time ! Your code works fine but... in column B there are some 1000 lines with a formula in them. only a certain number of cells have actual data in them. So it would be nice if your formula would only count the rows where the cell < "" Any ideas? thanks, Pierre Ron de Bruin wrote: Try this Pierre Sub test() Dim rngprint As Range Dim lr As Long Sheets("Outputdlnrs").Select lr = Range("B" & Rows.Count).End(xlUp).Row Set rngprint = Range("A1:M" & lr) rngprint.PrintPreview End Sub Hi experts, [quoted text clipped - 15 lines] Thanks, Pierre -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200510/1 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
printing a range that changes all the time
Hi Ron,
Wonderfull suggestion. but how do i go about this in VBA ? - autofilter on row 7 - in column B choose the non blanks - make printpreview - when the user presses print or close the autofilter should be turnd off again Thanks for your big help Ron Pierre Ron de Bruin wrote: Hi Pierre Why don't you filter with autofilter on nonblanks in column B and print Hi Ron, [quoted text clipped - 28 lines] Thanks, Pierre -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200510/1 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
printing a range that changes all the time
With the header of column B in B7 try this
Sub Print_with_Autofilter() With ActiveSheet .Range("B7:B100").AutoFilter Field:=1, Criteria1:="<" ActiveSheet.PrintPreview .AutoFilterMode = False End With End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "Pierre via OfficeKB.com" <u13950@uwe wrote in message news:566ce8bfc4910@uwe... Hi Ron, Wonderfull suggestion. but how do i go about this in VBA ? - autofilter on row 7 - in column B choose the non blanks - make printpreview - when the user presses print or close the autofilter should be turnd off again Thanks for your big help Ron Pierre Ron de Bruin wrote: Hi Pierre Why don't you filter with autofilter on nonblanks in column B and print Hi Ron, [quoted text clipped - 28 lines] Thanks, Pierre -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200510/1 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
page set up on excel to get 100% @ time of printing | Setting up and Configuration of Excel | |||
How can I do one-time printing without set page breaks? | Excel Discussion (Misc queries) | |||
printing time literally | Excel Programming | |||
Printing a range that is determined at run time | Excel Programming | |||
VB code for printing one page at a time | Excel Programming |