VBA to Copy Entire column from Workbook A to Workbook B

slapshock

New Member
Joined
Sep 13, 2021
Messages
10
Office Version
  1. 2013
Platform
  1. Windows
Hi Guys, i need help for a vba to copy an entire column from Workbook A except for the 1st row ( excluding blank cell) to another workbook, let say workbook B.
Workbook A has many sheets in which I need to copy specific column from each Sheets. and paste it to Workbook B.

Option 1 is Workbook A is open.
Option 2 is Workbook A is closed.

Thanks in advance
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
In Wb.A, copy column N from every sheet in Wb.A
to every sheet in Wb.B?
does Wb.B has the same # sheets as Wb.A?
 
Upvote 0
paste the code into a module in your PERSONAL workbook so it can run from any excel wb.
open both wb: A & B
select col in A you want to copy,
run: copyMycol

Code:
Sub copyMycol()
Dim wbSrc As Workbook, wbTarg As Workbook
Dim sCol As String
Dim iCol As Integer, i As Integer
Set wbSrc = ActiveWorkbook
For Each wbTarg In Workbooks
  If wbTarg.Name <> wbSrc.Name And InStr(wbTarg.Name, "PERSONAL") = 0 Then Exit For
Next
sCol = Mid(ActiveCell.Address, 2)
i = InStr(sCol, "$")
sCol = Left(sCol, i - 1)
Columns(sCol & ":" & sCol).Select
Selection.Copy
wbTarg.Activate
Range(sCol & "1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range(sCol & "1").Select
Selection.ClearContents
Set wbSrc = Nothing
Set wbTarg = Nothing
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,831
Messages
6,127,138
Members
449,361
Latest member
VBquery757

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top