Copy columns from one workbook to another

sco315

New Member
Joined
Jun 3, 2015
Messages
6
Hello, I am new to Macros and have no idea how to program what I need to.

I have a master spreadsheet on a shared drive, and a separate file on my local drive. I want to copy columns A, C, W, J, and V (in that order) from the 2nd worksheet (tab) in the shared excel file and copy it to columns A:E in the local excel file. I also want to create a button on different worksheet in the local excel file that refreshes those columns so the latest data is copied over.

Thank you
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Hello,

something like this perhaps?

Code:
Sub COPY_FROM_WORKBOOK()
    Columns("A:E").ClearContents
    Workbooks.Open ("C:\Workbook2.xls")
    Application.ScreenUpdating = False
    Range("A:A,C:C,W:W,J:J,V:V").Copy
    Workbooks("Workbook1.xls").Activate
    Range("A1").PasteSpecial (xlPasteValues)
    Columns("C:C").Insert
    Columns("F:F").Cut Range("C1")
    Application.ScreenUpdating = True
End Sub

you will need to rename the filenames and location.
 
Upvote 0

Forum statistics

Threads
1,207,011
Messages
6,076,145
Members
446,187
Latest member
LMill

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