jackyysteez
New Member
- Joined
- Jul 17, 2018
- Messages
- 8
I am fairly new to VBA and was given the task to disable the save feature on EPM if a Cost Center is an incorrect value, creating an incorrect LOB. I need the Cost Centers EPMMemberProperty to be equal to LOB_400 in order for it to save, and if it is not I need it to cancel. The data provided in Cell C27 gives a numerical value of the Cost Center but not it's LOB, so far my code looks like this..
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Private Property Get CostCenter() As String
Set CostCenter = Range("C27")
Set CostCenter.Name = Property.Name
strCostCenter = obj.CostCenter
CostCenter.Select.GetPropertyList
If CostCenter.Name <> LOB_400 Then
MsgBox "Wrong Cost Center provided!", vbCancel
Cancel = True
Else: Cancel = False
End If
End Property
End Sub
However, when I try and run it a Pop Up comes up about Naming the Macro... Any tips/words of advice would be gratefully appreciated! Thank You!
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Private Property Get CostCenter() As String
Set CostCenter = Range("C27")
Set CostCenter.Name = Property.Name
strCostCenter = obj.CostCenter
CostCenter.Select.GetPropertyList
If CostCenter.Name <> LOB_400 Then
MsgBox "Wrong Cost Center provided!", vbCancel
Cancel = True
Else: Cancel = False
End If
End Property
End Sub
However, when I try and run it a Pop Up comes up about Naming the Macro... Any tips/words of advice would be gratefully appreciated! Thank You!