Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Copy and transpose paste across several worksheets

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default Copy and transpose paste across several worksheets

On 6 Jun, 12:28, JohnP 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Copy and transpose paste across several worksheets

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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy transpose paste danel Excel Discussion (Misc queries) 0 December 27th 10 08:22 AM
Copy and Transpose Paste HAS Excel Discussion (Misc queries) 2 February 15th 09 01:50 PM
Copy then Paste with a transpose SteveM Excel Discussion (Misc queries) 2 November 29th 07 06:01 PM
Copy and transpose paste JohnP Excel Programming 0 June 5th 07 10:08 PM
Copy / Paste - Kind of Transpose Carl Jarvis New Users to Excel 1 October 11th 05 04:27 AM


All times are GMT +1. The time now is 09:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"