Forum Discussion
Excel help
Hey excel community,
I am currently running into a small design flaw from an original project I created a few months ago. Now I am looking for some advice on how to improve upon it. I have these two spreadsheets that share information. Spreadsheet A is primary and is getting updated often and Spreadsheet B is only changed if something has been added, removed or changed in Spreadsheet A. I am using a data connection in between the two. So basically, the process is as follows: users open spreadsheet A, make the changes and save it, then open Spreadsheet B and wait for the information to populate, close and save. Then, they open Badge software and wait for the information to populate as well. Things are working well, but there has to be a way to cut down the steps.
I'd like to figure out how to update Spreadsheet B's information without having to open Spreadsheet B. Is that possible?
Hi DougPCI,
If you can add a macro to your "source" spreadsheet (spreadsheetA.xlsx), you can try the following and run it whenever you update the source spreadsheet. You can even run this on a timer if you want.
Macro
Public Sub refreshXLS()
Path = "C:\test\Excel\spreadsheetB.xlsx" 'the workbook path you want to refreshWith Application
.DisplayAlerts = False
.ScreenUpdating = False
.EnableEvents = False
.AskToUpdateLinks = False
End WithWorkbooks.Open Path
ActiveWorkbook.UpdateLink Name:=ActiveWorkbook.LinkSources
ActiveWorkbook.Close TrueWith Application
.DisplayAlerts = True
.ScreenUpdating = True
.EnableEvents = True
.AskToUpdateLinks = True
End With
End SubPublic Sub refreshXLS()
Path = "C:\test\Excel\destination" 'the workbook path you want to refreshWith Application
.DisplayAlerts = False
.ScreenUpdating = False
.EnableEvents = False
.AskToUpdateLinks = False
End WithWorkbooks.Open Path
ActiveWorkbook.UpdateLink Name:=ActiveWorkbook.LinkSources
ActiveWorkbook.Close TrueWith Application
.DisplayAlerts = True
.ScreenUpdating = True
.EnableEvents = True
.AskToUpdateLinks = True
End With
End Sub---
If Macro is not an option, perhaps you could leave the spreadsheetB.xlsx open all the time. Probably not the the most efficient method but it will work.
3 Replies
- DougPCICopper Contributor
- BennadeauIron Contributor
Hi DougPCI,
If you can add a macro to your "source" spreadsheet (spreadsheetA.xlsx), you can try the following and run it whenever you update the source spreadsheet. You can even run this on a timer if you want.
Macro
Public Sub refreshXLS()
Path = "C:\test\Excel\spreadsheetB.xlsx" 'the workbook path you want to refreshWith Application
.DisplayAlerts = False
.ScreenUpdating = False
.EnableEvents = False
.AskToUpdateLinks = False
End WithWorkbooks.Open Path
ActiveWorkbook.UpdateLink Name:=ActiveWorkbook.LinkSources
ActiveWorkbook.Close TrueWith Application
.DisplayAlerts = True
.ScreenUpdating = True
.EnableEvents = True
.AskToUpdateLinks = True
End With
End SubPublic Sub refreshXLS()
Path = "C:\test\Excel\destination" 'the workbook path you want to refreshWith Application
.DisplayAlerts = False
.ScreenUpdating = False
.EnableEvents = False
.AskToUpdateLinks = False
End WithWorkbooks.Open Path
ActiveWorkbook.UpdateLink Name:=ActiveWorkbook.LinkSources
ActiveWorkbook.Close TrueWith Application
.DisplayAlerts = True
.ScreenUpdating = True
.EnableEvents = True
.AskToUpdateLinks = True
End With
End Sub---
If Macro is not an option, perhaps you could leave the spreadsheetB.xlsx open all the time. Probably not the the most efficient method but it will work.