ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to copy Column 1 of all sheets to a seperate sheet. (https://www.excelbanter.com/excel-programming/364017-macro-copy-column-1-all-sheets-seperate-sheet.html)

Rajula

Macro to copy Column 1 of all sheets to a seperate sheet.
 
Hi,

Can somebody help me create a macro to copy COLUMN 1 of all sheets in a
workbook(there are about 12 sheets) into another sheet??

Cheers
Rajula

Tom Ogilvy

Macro to copy Column 1 of all sheets to a seperate sheet.
 
Sub CopyData()
Dim bk as workbook, sh as worksheet
Dim i as Long, rng as Range
set bk = Workbooks("SourceData.xls")
set sh = Workbooks("Summary").Worksheets(1)
i = 1
for each sh in bk.Worksheets
set rng = sh.Columns(1)
rng.copy Destination:=sh.Columns(i)
i = i + 1
Next
End sub

--
Regards,
Tom Ogilvy



"Rajula" wrote:

Hi,

Can somebody help me create a macro to copy COLUMN 1 of all sheets in a
workbook(there are about 12 sheets) into another sheet??

Cheers
Rajula



All times are GMT +1. The time now is 02:21 AM.

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