selecting sheets in an array

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top