excel - Using VBA, how can I select multiple rows, on multiple worksheets for printing? -
i have spreadsheet contains multiple worksheets. need select rows, in worksheets, can print rows, across selected worksheets, single document.
the following code used select pertinent worksheets , rows printed. code works until attempt select rows second worksheet.
dim no_selected_worksheets boolean no_selected_worksheets = true dim list_choose long list_choose = 0 formstoprint.listcount - 1 if formstoprint.selected(list_choose) worksheets(list_choose + 2) if no_selected_worksheets .select 'this works. .rows.select 'so this. no_selected_worksheets = false else .select (false) 'this works too.. .rows.select ' here, vba reports error: ' "select method of range class failed" end if end end if next how can fix bug?
something this:
sub tester() dim long dim list_choose long list_choose = 0 formstoprint.listcount - 1 = + 1 if formstoprint.selected(list_choose) worksheets(list_choose + 2) .select (i = 1) 'edit below .pagesetup.printarea = .usedrange.address(false,false) end end if next activewindow.selectedsheets.printout copies:=1 end sub
Comments
Post a Comment