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


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

Re: Assistance in transposing multiple sets of data

From GS <gs@v.invalid>
Newsgroups microsoft.public.excel.programming
Subject Re: Assistance in transposing multiple sets of data
Date 2017-08-11 15:33 -0400
Organization A noiseless patient Spider
Message-ID <oml0im$fqs$1@dont-email.me> (permalink)
References <bc0ce361-46e9-4a33-b392-a81c5586443b@googlegroups.com> <omhp3n$pdu$1@dont-email.me> <4902a485-814b-4d8d-87f1-276a896d7337@googlegroups.com> <omk4k9$k7d$1@dont-email.me> <6ea3c3f8-18da-4a3f-b560-8462c3daa197@googlegroups.com>

Show all headers | View raw


Mark,
Just a note about using Copy; -you can assign one cell's value to another cell 
(or range) directly without incurring the extra overhead associated with 
Copy/PasteSpecial, and speed up your process by orders of magnitude...

  Dim wsSrc As Worksheet, wsTgt As Worksheet

  Set wsSrc = ActiveWorkbook.Sheets("Sheet1")
  Set wsTgt = ActiveWorkbook.Sheets("Sheet2")

  wsTgt.Range("A2:A15") = wsSrc.Range("B7")

This next line I don't understand because you are assigning a range to a single 
cell without resizing it to match the number of cells in the source range...

  wsTgt.Range("B2").Resize(rows?, cols?) = wsSrc.Range("A9:A22")

..where wsSrc has 14 cells and so wsTgt needs to be resized as follows:

  wsTgt.Range("B2").Resize(14, 1) = wsSrc.Range("A9:A22")
or
  wsTgt.Range("B2").Resize(1, 14) = 
Application.Transpose(wsSrc.Range("A9:A22"))

..where the latter puts a vertical range into a horizontal range.

-- 
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

Assistance in transposing multiple sets of data Living the Dream <noodnutt@gmail.com> - 2017-08-10 05:01 -0700
  Re: Assistance in transposing multiple sets of data Claus Busch <claus_busch@t-online.de> - 2017-08-10 16:07 +0200
    Re: Assistance in transposing multiple sets of data Living the Dream <noodnutt@gmail.com> - 2017-08-11 04:06 -0700
      Re: Assistance in transposing multiple sets of data Claus Busch <claus_busch@t-online.de> - 2017-08-11 13:36 +0200
        Re: Assistance in transposing multiple sets of data Living the Dream <noodnutt@gmail.com> - 2017-08-11 05:05 -0700
          Re: Assistance in transposing multiple sets of data Living the Dream <noodnutt@gmail.com> - 2017-08-11 05:13 -0700
            Re: Assistance in transposing multiple sets of data Claus Busch <claus_busch@t-online.de> - 2017-08-11 14:15 +0200
          Re: Assistance in transposing multiple sets of data GS <gs@v.invalid> - 2017-08-11 15:33 -0400
            Re: Assistance in transposing multiple sets of data Living the Dream <noodnutt@gmail.com> - 2017-08-29 06:14 -0700
              Re: Assistance in transposing multiple sets of data GS <gs@v.invalid> - 2017-08-29 11:11 -0400
                Re: Assistance in transposing multiple sets of data Claus Busch <claus_busch@t-online.de> - 2017-08-29 18:29 +0200
                Re: Assistance in transposing multiple sets of data GS <gs@v.invalid> - 2017-08-29 15:01 -0400

csiph-web