View Single Post
  #10   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 Sunday, February 16, 2014 12:39:24 AM UTC-8, Claus Busch wrote:
Hi Howard,



Am Sun, 16 Feb 2014 00:33:42 -0800 (PST) schrieb L. Howard:



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)




yes, that is correct. I prefer the Resize version.

For your 5 items I would hard code it without array



i= 6

for each rngc in myRng

wksTarget.cells(1, i) = rngc

i=i+1

next





Regards

Claus B.

--


I see. Goes to cell F1 then increments on over to J giving each cell the next values in rngc.

No end to the ways, just tough for me to grab out of the bag when needed.

Thanks.

Howard