How to create a macro to reference another workbook in current workbook

Chrisw83

New Member
Joined
Aug 18, 2017
Messages
2
Hi all. I am very new to this world but somehow managed to get a job as an analyst. I have a basic understanding of Excel so please bare with me. I am trying to create a macro that will take a string (\\naeanrfkfs101v.nadsusea.nads.navy.mil\NAVSUP$\NRFK\FISC\Metrics Data Input\1. Working documents\3. Dashboard_Scorecard\Past Months Finals) with a specific tab to a more recent string and its corresponding tab so I can compare data without opening 2 separate files. Can this be done? Thanks in advance.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
You can compare the data in the other workbook, but the macro would need to open the other workbook in the background.
For example, something like this:

Code:
sub CompareData
dim TestBook as Workbook
set TestBook = workbook.open("filepath\workbookname.xlsx")
'do whatever you are doing
Testbook.close

end sub
 
Upvote 0

Forum statistics

Threads
1,215,401
Messages
6,124,705
Members
449,182
Latest member
mrlanc20

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