I need to write a vba code that when run on my active sheet, will update & calculate the…
- User
I need to write a vba code that when run on my active sheet, will update & calculate the data in a hidden sheet called SrvSrch
- Assistant
As an AI language model, I don't have access to your specific worksheet and its details. However, here's some sample code that you can modify to update and calculate the data in a hidden sheet called SrvSrch:
Sub UpdateSrvSrchData()
'Define the SrvSrch sheet Dim SrvSrch As Worksheet Set SrvSrch = ThisWorkbook.Sheets("SrvSrch")
'Unhide the SrvSrch sheet SrvSrch.Visible = True
'Update and calculate the data in SrvSrch 'Insert your specific code here to update and calculate the data in SrvSrch
'Hide the SrvSrch sheet again SrvSrch.Visible = False
End Sub
You can call this macro from a button or shortcut key in your active sheet. Make sure the name of the hidden sheet matches the one in the code, and that your update and calculation code is added between the comments.
- User
I will not be entering data into the sheet. I want to calculate all the formulas and update all the links in the hidden sheet SrvSrch
- Assistant
Here's an updated code that calculates all formulas and updates all links in the hidden sheet SrvSrch:
Sub UpdateSrvSrchData()
'Define the SrvSrch sheet Dim SrvSrch As Worksheet Set SrvSrch = ThisWorkbook.Sheets("SrvSrch")
'Unhide the SrvSrch sheet SrvSrch.Visible = True
'Calculate all formulas in SrvSrch SrvSrch.Calculate
'Update all links in SrvSrch SrvSrch.UpdateLink SrvSrch.LinkSources
'Hide the SrvSrch sheet again SrvSrch.Visible = False
End Sub
This code will calculate all the formulas and update all the links in the hidden sheet SrvSrch. You can call this macro from a button or shortcut key in your active sheet. Make sure the name of the hidden sheet matches the one in the code.