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: 536
Default Array to Multiple Arrays

Earlier today Claus offered me a simpler version of copy array to an array code.

Here I have embellished it to copy from one array to four arrays.
As below, is this in line with best practices? It works fine as is, however on the fourth array I thought I could use... myArr5 = Array("L5:L12") but it errors out. Seems to want each cell listed in the array. I have seen an example in a google search where...

myArr5 = Array("L5:L12").Select
Selection = myArray

Or something similar.
The code is in a standard Module 1 of the workbook.
Your thoughts please.

Thanks.
Howard


Option Explicit

Sub Fill_Array_Add_To_Sheet()

Dim myarray(8) As Variant
Dim myArr2 As Variant
Dim myArr3 As Variant
Dim myArr4 As Variant
Dim myArr5 As Variant

Dim i As Integer

Sheets("Sheet1").Activate

myarray(0) = Range("F13")
myarray(1) = Range("F16")
myarray(2) = Range("F19")
myarray(3) = Range("I13")
myarray(4) = Range("I16")
myarray(5) = Range("I19")
myarray(6) = Range("L13")
myarray(7) = Range("K17")

Sheets("Sheet2").Activate

myArr2 = Array("F3", "C3", "D3", "I3", "J3", "M3", "O3", "P3")
myArr3 = Array("A3", "B5", "C7", "D9", "E11", "F13", "G15", "H17")
myArr4 = Array("A20", "B20", "C20", "D20", "E20", "F20", "G20", "H20")
myArr5 = Array("L5", "L6", "L7", "L8", "L9", "L10", "L11", "L12")

For i = LBound(myArr2) To UBound(myArr2)

Range(myArr2(i)) = myarray(i)
Range(myArr3(i)) = myarray(i)
Range(myArr4(i)) = myarray(i)
Range(myArr5(i)) = myarray(i)
Next
End Sub
 
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
RENEWED-- Arrays: Counting multiple values within array Trilux_nogo Excel Worksheet Functions 5 April 20th 07 01:30 AM
How do you create an Array of Arrays? NickHK Excel Programming 0 December 22nd 06 02:03 AM
How do you create an Array of Arrays? Arvi Laanemets Excel Programming 0 December 21st 06 06:35 PM
Creating a single vertical array from multiple column arrays Bryan Excel Worksheet Functions 2 December 10th 05 07:12 PM
Array of Arrays in VBA Peter[_49_] Excel Programming 0 November 9th 04 09:50 PM


All times are GMT +1. The time now is 09:39 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"