PC Review


Reply
Thread Tools Rate Thread

Copy and transpose paste across several worksheets

 
 
=?Utf-8?B?Sm9oblA=?=
Guest
Posts: n/a
 
      6th Jun 2007
Hi,

I need a macro that will copy a vertical set of data from one worksheet at a
time across all worksheets except one called "master" and paste that data
horizontally onto the next free row down on the master sheet starting with
row 2.

I also shell of a code that will allow some code I have written to be
applied to one worksheet at a time for all worksheets except one called
"master".

Let me know if you need more information. thanks in advance for any help you
can offer.

John P
 
Reply With Quote
 
 
 
 
james.billy@gmail.com
Guest
Posts: n/a
 
      6th Jun 2007
On 6 Jun, 12:28, JohnP <J...@discussions.microsoft.com> wrote:
> Hi,
>
> I need a macro that will copy a vertical set of data from one worksheet at a
> time across all worksheets except one called "master" and paste that data
> horizontally onto the next free row down on the master sheet starting with
> row 2.
>
> I also shell of a code that will allow some code I have written to be
> applied to one worksheet at a time for all worksheets except one called
> "master".
>
> Let me know if you need more information. thanks in advance for any help you
> can offer.
>
> John P


Hi John,

Here is some code (untested!)

dim xSht as worksheet
for each xSht in Sheets
if xSht.Name <> "Master" then
xSht.Range("A1:A50").copy ' <-- The range on each sheet you want
to copy
Sheets("Master").Range("A" & Cells(65536,1).end(xlup).row
+1).pastespecial xlValues, , , True '<-- On Master Sheet In column A
goto Next Available row and transpose Data
endif
next xSht

If you get any problems then let me know,

Regards,

James

 
Reply With Quote
 
Incidental
Guest
Posts: n/a
 
      6th Jun 2007
Hi

You could try something like this. It will pass the used range in
column A of each sheet in the workbook except the sheet named Master
to an array then on the sheet named Master it will place the elements
of the array in the next available row horizontally . This code is a
little ruff and I'm sure you could probably do it without having to
move between the sheets if you tinker with it a little. I added the
code to a button on a userform but you could rename the sub put it in
a module and run it from the Macro menu or set a keyboard shortcut.

Option Explicit
Dim MyArr
Dim WkSh As Worksheet
Dim FstCell, LstCell, MyCell As Range
Dim i, Cnt, oSet As Integer

Private Sub CommandButton1_Click()

For Each WkSh In Worksheets

If WkSh.Name <> "Master" Then 'Exclude sheet named Master

WkSh.Activate 'Activate sheet

Set FstCell = [A1] 'Set Range

Set LstCell = [A65535].End(xlUp) 'Set Range

MyArr = WkSh.Range(FstCell, LstCell) 'Pass Range to
array

Sheets("Master").Activate 'Go to Master sheet

Cnt = [A65535].End(xlUp).Row 'Find 1st
available row

If Cnt = 1 Then

Set MyCell = [A2]

Else

Set MyCell = [A65535].End(xlUp).Offset(1, 0)

End If

For i = 1 To UBound(MyArr) 'Pass array details to i

oSet = i - 1 'Set offset variable

If i = 1 Then 'If 1st element put in 1st cell

MyCell.Value = MyArr(i, 1)

Else 'Put in the next column

MyCell.Offset(0, oSet) = MyArr(i, 1)

End If

Next i

End If

Next WkSh 'Iterate Worksheet

End Sub

Hope this helps you out

S



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy transpose and paste error!? Darius Microsoft Excel Worksheet Functions 5 1st Aug 2009 04:23 PM
Copy and Transpose Paste HAS Microsoft Excel Misc 1 15th Feb 2009 01:50 PM
Copy then Paste with a transpose SteveM Microsoft Excel Misc 2 29th Nov 2007 06:01 PM
Copy and transpose paste =?Utf-8?B?Sm9oblA=?= Microsoft Excel Programming 0 5th Jun 2007 10:08 PM
Copy / Paste - Kind of Transpose Carl Jarvis Microsoft Excel New Users 1 11th Oct 2005 04:27 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:12 AM.