cancel
Showing results for 
Search instead for 
Did you mean: 

Refresh Macro in BPC based on condition

Former Member
0 Kudos

Dear BPC Friends,

I am working on BPC 10.1 NW. I am developing a input template which has two worksheets i.e 1) Report and 2) Input_Form.

Report has macro 'Refresh Tab' .This refresh tab work based on value of cell in K22 . When the value of this cell (k22) is "NO" then it will refresh the Report. But when the value of this cell (k22) is "YES" it just need to refresh Input_Form. I am using following code. This code is only working when the value of K22 is "NO".

Kindly advice how the macro should work when the value of K22 is "YES"

Option Explicit

Public Sub Refresh_Data()

Dim EPMObj As New FPMXLClient.EPMAddInAutomation

If Range("k22").Value = "No" Then

EPMObj.RefreshActiveWorkBook

End If

If Range("k22").Value = "yes" Then

EPMObj.refreshworkbook.("Input Schedule")

End If

End Sub

Thanks,

Rahul

Accepted Solutions (1)

Accepted Solutions (1)

former_member186338
Active Contributor

Just minimal corrections to JP code:

Public Sub Refresh_Data()

Dim EPMObj As New FPMXLClient.EPMAddInAutomation
If Range("A2").Value = "NO" Then
EPMObj.RefreshActiveWorkBook
Else If Range("A2").Value = "YES" Then
Worksheets("Input Schedule").Activate ' Input Schedule is the name of the sheet
EPMObj.RefreshActiveSheet
End If

End Sub

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks Vadim

Former Member
0 Kudos

Hi Rahul,

Sheet 2 is your input schedule sheet name.Try below code:

Option Explicit

Public Sub Button6_Click()

Dim EPMObj As New FPMXLClient.EPMAddInAutomation

If Range("A2").Value = "NO" Then

EPMObj.RefreshActiveSheet

End If

If Range("A2").Value = "YES" Then

Worksheets("Sheet2").Activate

EPMObj.RefreshActiveSheet

End If

End Sub

Regards,

JP