View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
GS[_6_] GS[_6_] is offline
external usenet poster
 
Posts: 1,182
Default Array list writing to an Array of 'scattered cells' ?

Is there a way to copy F1:F5 cells to cells A1, D5, H9, J6, M11, where these
are truly 'scattered'?

And a way to copy say, five truly scattered cells to five other truly
scattered cells?


Try...

Sub Copy_ScatteredCells()
Const sSrc$ = "F1,F2,F3,F4,F5": Const sTgt$ = "A1,D5,H9,J6,M11"
Dim n&, vaSrc, vaTgt

vaSrc = Split(sSrc, ","): vaTgt = Split(sTgt, ",")
For n = LBound(vaSrc) To UBound(vaSrc)
Range(vaTgt(n)) = Range(vaSrc(n))
Next 'n
End Sub

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion