ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy column A and column D from all sheets into new worksheet (https://www.excelbanter.com/excel-programming/351084-copy-column-column-d-all-sheets-into-new-worksheet.html)

al007

Copy column A and column D from all sheets into new worksheet
 
How can I copy column A and column D from all sheets to a new sheet
while offsetting the paste ie the 2 column being pasted next to the
other

thxs

posting again as i've got an unclear answer from an ...


Toppers

Copy column A and column D from all sheets into new worksheet
 
Hi,
I assume Sheet1 columns A and D are copied to A,B on "newsheet"
and A and D from other sheets are copied to columns C,D/E,F etc as your
request indicates you want to copy columns in total to a single new sheet.

Sub CopyAandD()

Dim oRng As Range
Dim newsh As Worksheet

Set newsh = Worksheets("Sheet3") ' <==== Change to your "new sheet"
Set oRng = newsh.Range("A:A") ' <===== Copy to column A

For Each Sh In ActiveWorkbook.Worksheets
If Sh.Name < newsh.Name Then
Sh.Range("A:A,D:D").Copy oRng
Set oRng = oRng.Offset(0, 2)
End If
Next

End Sub

"al007" wrote:

How can I copy column A and column D from all sheets to a new sheet
while offsetting the paste ie the 2 column being pasted next to the
other

thxs

posting again as i've got an unclear answer from an ...




All times are GMT +1. The time now is 03:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com