Skip to Content
avatar image
Former Member

Refresh Macro in BPC based on condition

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Oct 21, 2016 at 08:17 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 20, 2016 at 06:37 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 21, 2017 at 02:38 PM

    Thanks Vadim

    Add comment
    10|10000 characters needed characters exceeded