cancel
Showing results for 
Search instead for 
Did you mean: 

Refresh single Worksheet in BPC 10.0

Former Member
0 Kudos

Hi Everyone,
I need your help to write a VBA macro for a button, to refresh a single knwon worksheet in workbook.

It's not the active sheet.

Thanks.

Med Amine

Accepted Solutions (1)

Accepted Solutions (1)

cecilia_petersson2
Active Participant
0 Kudos

Hi Med Amine,

Try this one (assuming that your macro button sits in the DataInput sheet)!

/Cecilia

Former Member
0 Kudos

Only thing I would add  would be to disable screen updating so the refresh is happening in the background, also note if a sheet is hidden it can't be refreshed.

Leverage Application.ScreenUpdating = True/False to hide selecting the sheet to refresh it.

Leverage Sheet("SheetToRefresh).Hidden = True/False if the sheet is hidden from view

Former Member
0 Kudos

Thanks Cecilia, it works
I'll be trying to hide the sheet selection if possible as Ryan said.

Med Amine

Former Member
0 Kudos

Thanks Ryan, I'm trying to refresh in Background, so i modified my code like this:

Sub RefreshSheet()

     Dim epm As New FPMXLClient.EPMAddInAutomation

     Application.ScreenUpdating = False

     Sheets("SHEET1").Select

     epm.RefreshActiveSheet

     Sheets("HOME").Select

End Sub

But it doesn't work, any suggetion?

Thanks

Med Amine

Former Member
0 Kudos

Its important to turn functions back on if they are turned off while the vb is running.  Here I've added all the items I normally use in my code mostly due to performance:

Sub RefreshSheet()

On Error Goto Abort

Application.EnableEvents = False

Application.ScreenUpdating = False

Application.DisplayAlerts = False

Application.Calculation = xlManual


     Dim epm As New FPMXLClient.EPMAddInAutomation

     Sheets("SHEET1").Select

     epm.RefreshActiveSheet

     Sheets("HOME").Select

Abort:

Application.DisplayAlerts = True

Application.Calculation = xlAutomatic

Application.EnableEvents = True

Application.ScreenUpdating = True

End Sub

Former Member
0 Kudos

Thank you Ryan So much, it works for me but without the On Error statement

Answers (0)