Help Making a Macro to Pull from Excel files with Today's Date Everyday

AP Daniel

New Member
Joined
May 31, 2023
Messages
1
Office Version
  1. 2021
  2. 2016
Platform
  1. Windows
Hello everyone,

I am completely new to this process. I managed to make a version of this code work that would pull from one instance, but not each new day's file. The short version, I need a macro to pull 2 different files, from 2 different locations, to 2 different sheets in my main workbook. Currently I copy and paste, but I need to be able to have others access the information without looking it up themselves. Thank you for the help, the code is to follow.

Sub get_data()



Dim Wb1 As Workbook



'Dont update the screen - makes it work faster

Application.ScreenUpdating = False



'Open the other workbook

'Input the FULL path to the file, including its extension

Set Wb1 = Workbooks.Open("M:\Prod_ctl\Rainbow Report Updates\Rainbow Report*.xlsx")



'You can do whatever you want here with the other workbook - it is now open.

'This just copies some cells.

Wb1.Sheets("sheet1").Range("c:c").Copy



'Close the workbook from which we just got some data and make sure not to save it in case accidental changes were made to it.

Wb1.Close SaveChanges:=False



'Turn on screen updating again - makes Excel usable

Application.ScreenUpdating = True

ActiveWorkbook.Sheets("priority list").Range("a2").PasteSpecial




End Sub
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Forum statistics

Threads
1,215,731
Messages
6,126,539
Members
449,316
Latest member
sravya

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