LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default Working with Arrays

I am trying to use an array to move a group of sheets from one workbook to a
new workbook. I know how to move them ALL at once to a new workbook using:

Sheets(array("Sheet1", "Sheet2", "etc.")).Move

However, only want to sent select sheets (selected by another, working,
section of code). Here is my code, so far:

' define and setup variables
Dim create_array, all_graphs
Dim offset_var As Long
Dim array_counter As Long

offset_var = 0
array_counter = 0
' this is a list of all the sheets that CAN exist
all_graphs = Array("1.1.1 - LD AN Consumption", "1.2.1 - AN Amounts", "1.3.1
- Total AN Consumption", "2.1.1 - Tank Temperature", "2.1.2 - Fudge Point",
"2.1.3 - pH", "3.1.1 - Blender Speed", "3.1.2 - Hot Cup Density", "3.1.3 -
Viscosity", "4.1.1 - Truck Cup Densities", "4.2.1 - PE105 Calibration - AN",
"4.2.2 - PE105 Calibration - Emu", "4.2.3 - PE105 Calibration - FO", "4.3.1 -
PE106 Calibration - AN", "4.3.2 - PE106 Calibration - Emu", "4.3.3 - PE106
Calibration - FO", "4.4.1 - PE105 - Scale vs. Load", "4.4.2 - PE106 - Scale
vs. Load", "5.1.1 - Tank Temperature", "5.1.2 - Fudge Point", "5.1.3 - pH",
"6.1.1 - Blender Speed", "6.1.2 - Hot Cup Density", "6.1.3 - Viscosity",
"7.1.1 - ANFO Test", "8.1.1 - Calibration - Unit 8018", "8.1.2 - Calibration
- Unit 8025")

' there are a total of 27 potential sheets, however, only the ones with a
value of 1, found at range_create.Offset(offset_var, 0), will actually exist
While offset_var < 27
If range_create.Offset(offset_var, 0).Value = 1 Then
create_array = all_graphs(offset_var + 1)
End If
offset_var = offset_var + 1
Wend

' move chart sheets to the end of a new workbook
Sheets(create_array()).Move



The section of my code that doesn't seem to work, at all, is
Sheets(create_array()).Move. How do I implement this properly, or is there a
problem with the previous section? I originally had it say:

If range_create.Offset(0, 0) = 1 Then
Sheets(Array("1.1.1 - LD AN Consumption").Move
End If
' etc... all the way to the last one, but it only worked for the first one,
and then crashed, it didn't want to add it to the same "new" workbook or
another new one, which wasn't my needs anyways


Thanks you Jon Peltier, Peter T., Dave Peterson, and ND Pard for all your
help on that last section of code. I am still stuck working on it, but it is
not necessary to complete at this time
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SUMPRODUCT with 3 arrays not working Kierano Excel Worksheet Functions 1 October 16th 06 03:37 PM
Working with ranges in arrays... or an introduction to arrays Glen Excel Programming 5 September 10th 06 08:32 AM
Working with Arrays Judy Excel Worksheet Functions 1 January 11th 06 12:22 AM
Working with arrays filo666 Excel Programming 2 December 16th 05 05:23 PM
working on 2 different worksheets....arrays? monika Excel Programming 6 February 10th 04 11:40 AM


All times are GMT +1. The time now is 09:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"