cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

After Refresh and Before Refresh

brahmareddy_kolli
Participant
0 Likes
1,486

Hi Experts,

In workbook ,I am having around 10 sheets. I am using Workbook Refresh macro, there is no Worksheet refresh.

While I am doing Workbook refresh, I want to call Three macro's in between After refresh and before refresh. These three macro should call for two sheets only not  for other sheets.

I am trying put if condition in Before Refresh and After Refresh Macro.

I am these macro's into Before /after refresh :CheckDel,Hiddenrrows and UnHiddenrows

But its not working as expected. Pls suggest me on the same.

Dim tem1 As String

Dim tem2 As String

Public Function AFTER_REFRESH() As String

If tem1="Sheetname1" Then

ChecknDel

    AFTER_REFRESH = True

Else

If tem2="Sheetname2" Then

  Hiddenrows

    AFTER_REFRESH = True

Else

AFTER_REFRESH = False

End If

End If

End Function

--------------------------------------------------------

Dim tem_un As String

Public Function BEFORE_REFRESH() As String

If tem_un="Sheetname2" Then

  UnHiddenrows

    BEFORE_REFRESH = True

Else

BEFORE_REFRESH = False

End If

End Function

Message was edited by: BrahmaReddy Kolli

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member186338
Active Contributor
0 Likes

Sorry, but the explanation is totally unclear!

BEFORE_REFRESH and AFTER_REFRESH are triggered on the REFRESH event only once independent of the number of reports/sheets refreshed.

The code in BEFORE_REFRESH or AFTER_REFRESH has to specifically change the required sheets! And I don't see this code.

Your VBA is strange, what do you mean:

Dim tem1 As String

Dim tem2 As String

Public Function AFTER_REFRESH() As String '- AS STRING??? As Boolean!

If tem1="Sheetname1" Then '- tem1 is a not assigned variable, will never be Sheetname1

...

former_member186338
Active Contributor
0 Likes

P.S. Sample:

You have 3 sheets with:

Sheet1 - 2 reports

Sheet2 - 1 report

Sheet3 - 1 report

Your Sheet1 is currently active and the cell of the first report is selected.

You press Refresh Report - only first report will be refreshed.

You press Refresh Worksheet - 2 reports will be refreshed

You press Refresh Workbook - all 4 reports on 3 sheets will be refreshed

In all cases you will have single BEFORE_REFRESH and AFTER_REFRESH events

brahmareddy_kolli
Participant
0 Likes

Thanks for your reply.

In requirement will have only one button for  refresh workbook, don't have worksheet refresh macro. They will not go and refresh very sheet.

former_member186338
Active Contributor
0 Likes

Sorry, but "In requirement will have only one button for  refresh workbook, don't have worksheet refresh macro." - unclear!

In the standard EPM ribbon you always have:

"They will not go and refresh very sheet." - why not?