ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   why this code not working (https://www.excelbanter.com/excel-programming/275914-re-why-code-not-working.html)

tj

why this code not working
 
For one, your naming convention is a bit confusing. rng, rng1, rng2
would be better named rngCurrent, rngPrint, rngSelect instead of the
more used and lazy method that we all want to get into. My suspects
are it is a conflict with your rng names, but I need to know more of
the application to make a more def responce.

Thurman



"sulu" wrote in message ...
hi all,

i just want to select first 6 column s of my filtered
data range

what is wrong with my code?

Set rng = ActiveSheet.AutoFilter.Range
On Error Resume Next
With rng

Set rng1 = .Offset(1, 0).Resize(.Rows.Count - 1, 6) _
.SpecialCells(xlCellTypeVisible)

End With

With ActiveSheet.PageSetup
.PrintArea = Range ("rng2")
.CenterFooter = "Page &P of &N"
.RightFooter = "Printed on &D"
.PrintHeadings = False
.CenterHorizontally = True
.Orientation = xlPortrait
.PrintTitleRows = "$2:$2"
.FitToPagesWide = 1

End With

Sulu



All times are GMT +1. The time now is 10:51 AM.

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