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

Macro with if condition in EPM BPC 10.0 NW version.

BalaValluru
Participant
0 Likes
1,140

Hello Experts,

Need some help on macro code. Save data with if condition.

Below is inputtemplate having negative values coming from othersheets and i need to allocate the data as below

If i click on Save macro button it should check if Total is zero then only should save else should not save the data after click on macro button. ( for all total columns H:Total /I:total,J:Total)

I tried with some code below and not sure how to apply the code if condition is true save the data?

Please advise some macro code if you have already implemented.

Thanks

Kishore V

Accepted Solutions (1)

Accepted Solutions (1)

former_member186338
Active Contributor
0 Likes

Easy:

If Range("H27").Value = 0 And Range("I27").Value = 0 And Range("J27").Value = 0 Then
   ref.SaveWorksheetData
Else
   MsgBox "Totals not Equal to zero"
End If

Answers (6)

Answers (6)

BalaValluru
Participant
0 Likes

vadim.kalinin

I have opened separate thread for above issue and example scenario given. Please help in macro code to save data from multiple sheets with if condition (if total is zero save )

Please find the thread open newly

https://answers.sap.com/questions/13131508/bpc-save-macro-for-multiple-sheets-with-if-conditi.html

Thanks

Kishore V

BalaValluru
Participant
0 Likes

vadim.kalinin

I have 3 input forms in same sheet to allocate the different countries data

Regards

KIshore V

former_member186338
Active Contributor
0 Likes

Sorry, but in case of 3 input forms you have to define the logic:

What to do if only one input form is incorrect?

You current VBA is totally incorrect:

You are testing the first input form and then saving ALL input forms!

Define the logic.

BalaValluru
Participant
0 Likes

vadim.kalinin

Can you please let me know where to place GetReportsDatacountToSubmit in EPM Save macro.

Best Regards

Kishore V

former_member186338
Active Contributor
0 Likes

Sorry, but your whole code is very strange!

Do you have multiple reports on the same sheet?

What is the idea to perform full worksheet save 3 times???

?????

former_member186338
Active Contributor
0 Likes

Please read my old answer:

https://answers.sap.com/questions/11614501/detect-data-to-save.html

GetReportsDataCountToSubmit

BalaValluru
Participant
0 Likes

vadim.kalinin

Below save macro code is working fine and only we dont want to see the below message after click on macro save data button. Could you please help me macro code any thing need to do modify.

Dim EPM As New FPMXLClient.EPMAddInAutomation
Sub save()
Dim ref As New EPMAddInAutomation
ref.SaveWorksheetData


If Range("H27").Value = 0 And Range("I27").Value = 0 And Range("J27").Value = 0 And Range("K27").Value = 0 And Range("L27").Value = 0 And Range("M27").Value = 0 Then
   ref.SaveWorksheetData
End If


If Range("H54").Value = 0 And Range("I54").Value = 0 And Range("J54").Value = 0 And Range("K54").Value = 0 And Range("L54").Value = 0 And Range("M54").Value = 0 Then
   ref.SaveWorksheetData
  
End If

If Range("H86").Value = 0 And Range("I86").Value = 0 And Range("J86").Value = 0 And Range("K86").Value = 0 And Range("L86").Value = 0 And Range("M86").Value = 0 Then
   ref.SaveWorksheetData
   
End If
End Sub

Thanks

BalaValluru
Participant
0 Likes

vadim.kalinin

Thank you and it is working fine

Regards

Kishore V