I hope that some one can help I am attempting to do either of the 2 functions below and neither are working. I would like to either print a number of pages depending on a cell value or print a range of cells depending on a cell value. The worksheet is made up of 40 pages and every time it still prints the 40 pages regardless of wants in the cells value.
Any help will be greatly appreciated.
Sub PRINT_PAGES()
Sheets("SHEET1").Select
Columns("D:G").Hidden = True
Columns("I:I").Hidden = True
a = Range("AD1").Value
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=a, Copies:=1
Columns("D:I").Hidden = False
Sheets("MAINSHEET").Select
End Sub
OR
SUB PRINT RANGES()
Sheets("SHEET1").Select
Columns("D:G").Hidden = True
Columns("I:I").Hidden = True
ActiveSheet.PageSetup.PrintArea = "A1:U" & "AD2"
ActiveWindow.SelectedSheets.PrintOut Copies:=1
Columns("D:I").Hidden = False
Sheets("MAINSHEET").Select
End Sub
The page is set up to 40 pages long and it does not matter what I enter it still prints the 40 pages. If i set the range to a static number it will print the range but if I have to take the value from a cell it still only prints 40 pages. I would like to be able to print the number of pages depending on cell value,
Anyone's help would be appreciated.
Thanks
Bookmarks