Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.excel.programming > #109937

Re: Array list writing to an Array of 'scattered cells' ?

From GS <gs@v.invalid>
Newsgroups microsoft.public.excel.programming
Subject Re: Array list writing to an Array of 'scattered cells' ?
Date 2017-03-25 05:52 -0400
Organization A noiseless patient Spider
Message-ID <ob5ef2$crc$1@dont-email.me> (permalink)
References (9 earlier) <ob2qgl$ik3$1@dont-email.me> <fecf4f8f-af11-4374-b8c6-44e4e1f4cd46@googlegroups.com> <472ee718-09e9-4610-b51b-9543d6fe684d@googlegroups.com> <ob54sb$j9s$1@dont-email.me> <eea640f3-2068-48e0-9af4-5f9894b6cfb9@googlegroups.com>

Show all headers | View raw


Here's how I'd do it...


Sub Copy_SrcToTgt()
  Dim n&, v1, v2
  Dim wksSrc As Worksheet, wksTgt As Worksheet

  Const sSrc$ = "A1,C3,E5,G7,I10": Const sTgt$ = "P2,N4,L6,J8,H10"
  Const sSrcTgt$ | "A4:A6|O4:O6,C5:C8|P5:P8,A9|Q9,B11|R11"

  'Set ref to source sheet
  Set wksSrc = ThisWorkbook.Sheets("Sheet3")
  On Error GoTo Cleanup

  'Set 1st target sheet and process it
  Set wksTgt = Workbooks("Other.xls").Sheets("Sheet2")
  v1 = Split(sSrc, ","): v2 = Split(sTgt, ",")
  For n = LBound(vaSrc) To UBound(vaSrc)
    wksTgt.Range(v2(n)) = wksSrc.Range(v1(n))
  Next 'n

  'Set 2nd target sheet and process it
  Set wksTgt = Workbooks("SomeOther.xls").Sheets("Sheet4")
  v1 = Split(sSrcTgt, ",")
  For n = LBound(v1) To UBound(v1)
       'Parse the Src:Tgt cell addresses
       v2 = Split(v1(n), "|")
       Range(v2(1)) = Application.Transpose(Range(v2(0)))
     Next 'n

Cleanup:
  Set wksSrc = Nothing: Set wksTgt = Nothing
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

Back to microsoft.public.excel.programming | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Array list writing to an Array of 'scattered cells' ? "L. Howard" <lhkittle@comcast.net> - 2017-03-13 17:28 -0700
  Re: Array list writing to an Array of 'scattered cells' ? GS <gs@v.invalid> - 2017-03-14 00:24 -0400
    Re: Array list writing to an Array of 'scattered cells' ? "L. Howard" <lhkittle@comcast.net> - 2017-03-13 23:16 -0700
      Re: Array list writing to an Array of 'scattered cells' ? GS <gs@v.invalid> - 2017-03-14 05:38 -0400
        Re: Array list writing to an Array of 'scattered cells' ? "L. Howard" <lhkittle@comcast.net> - 2017-03-14 08:58 -0700
          Re: Array list writing to an Array of 'scattered cells' ? GS <gs@v.invalid> - 2017-03-14 14:25 -0400
            Re: Array list writing to an Array of 'scattered cells' ? "L. Howard" <lhkittle@comcast.net> - 2017-03-14 19:03 -0700
              Re: Array list writing to an Array of 'scattered cells' ? GS <gs@v.invalid> - 2017-03-14 22:09 -0400
                Re: Array list writing to an Array of 'scattered cells' ? "L. Howard" <lhkittle@comcast.net> - 2017-03-24 01:56 -0700
                Re: Array list writing to an Array of 'scattered cells' ? Claus Busch <claus_busch@t-online.de> - 2017-03-24 10:02 +0100
                Re: Array list writing to an Array of 'scattered cells' ? "L. Howard" <lhkittle@comcast.net> - 2017-03-24 08:13 -0700
                Re: Array list writing to an Array of 'scattered cells' ? GS <gs@v.invalid> - 2017-03-24 05:59 -0400
                Re: Array list writing to an Array of 'scattered cells' ? "L. Howard" <lhkittle@comcast.net> - 2017-03-24 08:24 -0700
                Re: Array list writing to an Array of 'scattered cells' ? "L. Howard" <lhkittle@comcast.net> - 2017-03-24 23:07 -0700
                Re: Array list writing to an Array of 'scattered cells' ? GS <gs@v.invalid> - 2017-03-25 03:08 -0400
                Re: Array list writing to an Array of 'scattered cells' ? "L. Howard" <lhkittle@comcast.net> - 2017-03-25 02:16 -0700
                Re: Array list writing to an Array of 'scattered cells' ? GS <gs@v.invalid> - 2017-03-25 05:52 -0400
                Re: Array list writing to an Array of 'scattered cells' ? GS <gs@v.invalid> - 2017-03-25 05:54 -0400
                Re: Array list writing to an Array of 'scattered cells' ? "L. Howard" <lhkittle@comcast.net> - 2017-03-25 07:41 -0700
                Re: Array list writing to an Array of 'scattered cells' ? Claus Busch <claus_busch@t-online.de> - 2017-03-25 16:04 +0100
                Re: Array list writing to an Array of 'scattered cells' ? "L. Howard" <lhkittle@comcast.net> - 2017-03-25 11:05 -0700
                Re: Array list writing to an Array of 'scattered cells' ? GS <gs@v.invalid> - 2017-03-25 18:28 -0400
  Re: Array list writing to an Array of 'scattered cells' ? GS <gs@v.invalid> - 2017-03-25 21:29 -0400
    Re: Array list writing to an Array of 'scattered cells' ? GS <gs@v.invalid> - 2017-03-25 22:41 -0400
    Re: Array list writing to an Array of 'scattered cells' ? GS <gs@v.invalid> - 2017-03-28 12:49 -0400

csiph-web