If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
selecting sheets in an array
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 |
#2
|
|||
|
|||
selecting sheets in an array
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. -- Earl Kiosterud mvpearl omitthisword at verizon period net ------------------------------------------- wrote in message ... 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 |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Comparing ARRAY elements with RANGE data and created a 2nd array | JimP | Worksheet Functions | 2 | March 10th, 2004 07:29 PM |
Array reference from current row to bottom of column | JM | Worksheet Functions | 0 | February 26th, 2004 01:09 PM |
Question on Array Formula | John | Worksheet Functions | 1 | February 21st, 2004 05:40 PM |