View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
L. Howard L. Howard is offline
external usenet poster
 
Posts: 852
Default Arrays and scattered cell values or another way?

On Saturday, February 15, 2014 11:36:24 PM UTC-8, Claus Busch wrote:
Hi Howard,



Am Sat, 15 Feb 2014 14:56:35 -0800 (PST) schrieb L. Howard:



wksTarget.Range("F1").Resize(columnsize:=myRng.Cel ls.Count) = myArr




if you know the number of items in your array you can also assign the

items to a range

wksTarget.Range("F1").Resize(columnsize:=myRng.Cel ls.Count)

is the same as

wksTarget.Range("F1:J1")

so you can write

wksTarget.Range("F1:J1") = myArr





Regards

Claus B.

--



Okay, so if hard code five or so cells into myRng likr this

Set myRng = Range("B2,G2,B11,K16,F17")

Then you can use wksTarget.Range("F1:J1") = myArr

But if your code is looking for an unknown or variable row or column length or perhaps looking for all values in UsedRange then you would use this

wksTarget.Range("F1").Resize(columnsize:=myRng.Cel ls.Count)


Is that correct?

Howard