Macro to import list automatically from a workbook to another workbook

danish6061

New Member
Joined
Mar 16, 2020
Messages
29
Office Version
2016
Platform
Windows
I have 2 workbooks with various columns I want to import some columns automatically from workbook A to workbook B. Is it possible?
 

Some videos you may like

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Mel Smith

Well-known Member
Joined
Dec 13, 2005
Messages
671
Office Version
365
Platform
Windows
With both workbooks open, record a macro to do this (once) and then create a button and assign the macro to it.
 

danish6061

New Member
Joined
Mar 16, 2020
Messages
29
Office Version
2016
Platform
Windows
Thanxx Alansidman and Smith,
But could you explain me complete process, because I dont know anything about macro?
 

Mel Smith

Well-known Member
Joined
Dec 13, 2005
Messages
671
Office Version
365
Platform
Windows
Make sure that you have both workbooks open. In the workbook that you want the imported columns to be pasted into:
1. in the bottom left-hand corner of the workbook you will see an icon that looks like a camera. Click on it and a small window will open with "Macro1" highlighted. Type into this small box a meaningful name like "PasteFromWbk" and click on OK
2. Now simply carry out the steps you need to take to copy the columns from one workbook to the other
3. When you have completed this, click on the same icon (which is now just an empty square) that you did to start recording the macro
4. In the workbook with the macro, click on Insert/Text Box and type in a title e.g. Import Data.
5. Right click on the text box and assign macro (PasteFromWbk)
6. Save and close the workbooks, the workbook with the macro must be saved as a macro-enabled workbook
7. Re-open the workbook with the macro in it, delete the recently imported and then click on the text box to import the data

I hope this helps.

Mel
 

Mel Smith

Well-known Member
Joined
Dec 13, 2005
Messages
671
Office Version
365
Platform
Windows
Look on the ribbon then select Insert and Text Box
When you have drawn the text box, click in the middle of it and type in a meaningful name

Mel
 

danish6061

New Member
Joined
Mar 16, 2020
Messages
29
Office Version
2016
Platform
Windows
Brother its not working, it's showing "run time error 9 subscript out of range"
 

Mel Smith

Well-known Member
Joined
Dec 13, 2005
Messages
671
Office Version
365
Platform
Windows
Go over everything you've done to make sure that the ranges you are trying to copy and paste are correct and the destination cell(s) are correct also. The macro you recorded is using "absolute" references so if you said copy range A1:A65 and paste to (other workbook range) range B1, then then is what should happen EVERY time

Mel
 

Forum statistics

Threads
1,089,218
Messages
5,406,922
Members
403,112
Latest member
rminor

This Week's Hot Topics

Top