G
Guest
I have recorded a macro and am experiencing problems because during the
recording of the macro sheet names have been hard coded. As time has
progressed, extra data has been added and extra sheets have been added and
therefore when I run it I get the message “Run time Error ‘9’, Subscript out
of rangeâ€. When I select debug it points to the line that starts
Sheets(Array("sheet 1â€, “sheet 2â€,….â€
I therefore have 2 problems:-
Problem 1.
Sheets("ZZZ ABC").Select
Sheets("ZZZ ABC ").Copy After:=Sheets(67)
Sheets("ZZZ ABC (2)").Select
Sheets("ZZZ ABC (2)").Name = "Total"
How can the above be changed so that rather than selecting sheet called ZZZ
ABC, the very last sheet is selected, copied and then renamed to Total?
Problem 2.
How can the array statement be changed so that it selects all sheets except
TOTAL? rather than as present which looks like:-
Sheets(Array("sheet 1â€, “sheet 2â€,….â€
Please help, thank you in anticipation.
recording of the macro sheet names have been hard coded. As time has
progressed, extra data has been added and extra sheets have been added and
therefore when I run it I get the message “Run time Error ‘9’, Subscript out
of rangeâ€. When I select debug it points to the line that starts
Sheets(Array("sheet 1â€, “sheet 2â€,….â€
I therefore have 2 problems:-
Problem 1.
Sheets("ZZZ ABC").Select
Sheets("ZZZ ABC ").Copy After:=Sheets(67)
Sheets("ZZZ ABC (2)").Select
Sheets("ZZZ ABC (2)").Name = "Total"
How can the above be changed so that rather than selecting sheet called ZZZ
ABC, the very last sheet is selected, copied and then renamed to Total?
Problem 2.
How can the array statement be changed so that it selects all sheets except
TOTAL? rather than as present which looks like:-
Sheets(Array("sheet 1â€, “sheet 2â€,….â€
Please help, thank you in anticipation.