View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default printing a range that changes all the time

Hi Pierre

youy can unhide and hide in the code

Sub Print_with_Autofilter()
With Sheets("Sheet1")
.Visible = True
.Range("B7:B100").AutoFilter Field:=1, Criteria1:="<"
.PrintPreview
.AutoFilterMode = False
.Visible = False
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Pierre via OfficeKB.com" <u13950@uwe wrote in message news:5679d61d4826d@uwe...
Ron,

Thanks man, you're the best !
This works great form me.

P.S. i found out that when the sheet is hidden, this code does not work.
Is there a way to keep the sheet hidden and still be able to present the
printpreview so users can pritn this out ?

Ron de Bruin wrote:
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

Hi Ron,

[quoted text clipped - 18 lines]
Thanks,
Pierre



--
Message posted via http://www.officekb.com