Hi All,
I am new to the Excel VBA. I am using the below code snippet to validate the excel data set but getting Compiler Error | Sub or Function not defined. Could someone guide me on this issue:
Thanks,
Rameez Shaik
I am new to the Excel VBA. I am using the below code snippet to validate the excel data set but getting Compiler Error | Sub or Function not defined. Could someone guide me on this issue:
Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
Cancel As Boolean)
'######################################################################################
'CUST_GRP_NAME Validation Started
'######################################################################################
Activate
Range("A2").Select
exceptionCount = 0
Do Until ActiveCell.Address = "$B$10"
' Check if the CUST_GRP_NAME is Not Null
If IsEmpty(ActiveCell.Value) Then
totalExceptions = 1
exceptionCount = 1
Interior.ColorIndex = 6 'Highlight with Yellow Color
Else
Interior.ColorIndex = 15 'Retain Grey Color
End If
Offset(1, 0).Select
Loop
If exceptionCount = 1 Then
exceptionString = exceptionString + vbCrLf & "- CUST_GRP_NAME Cannot be Empty"
End If
'#######'CUST_GRP_NAME Validation Completed '##############################################
End Sub
Thanks,
Rameez Shaik