selecting sheets in an array

G

Guest

hi

i want to select a few sheets and move it before a sheet
name total.

i have to program as :
Sheets(Array("Q1 2005", "Q2 2005", "Q3 2005")).Select
Sheets(Array("Q1 2005", "Q2 2005", "Q3 2005")).Move
After:=Sheets(9)

i am successful is forming the string
Sheets(Array("Q1 2005", "Q2 2005", "Q3 2005")) by the code
as:
str = ""
For n = 1 To m
If n = m Then comStr = "" Else comStr = ","
If n = 1 Then begStr = "Sheets(Array(" Else begStr = ""
If n = m Then endStr = "))" Else endStr = ""
str = begStr & str & """" & arrSh(n) & """" & comStr &
endStr
Next n
Debug.Print str


str final output would be as:
"Sheets(Array("Q1 2005", "Q2 2005", "Q3 2005"))"
but i am unable to use this str... likfe i want to now do
as str.select. how to acheive that
i hope i am clear
 
E

Earl Kiosterud

Perhaps you can use:

Sheets(Array(arrSh(1), arrSh(2), ... )).Move After:=Sheets(9)

Also, it isn't necessary to select the sheets to move them.
 
Top