Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
SUMPRODUCT with 3 arrays not working | Excel Worksheet Functions | |||
Working with ranges in arrays... or an introduction to arrays | Excel Programming | |||
Working with Arrays | Excel Worksheet Functions | |||
Working with arrays | Excel Programming | |||
working on 2 different worksheets....arrays? | Excel Programming |