Hi,
I am trying to Activate a worksheet based on a condition.The condition is the return value of a function.
Private Function ChkValidation()
Dim returnValue As Boolean
returnValue = True
If Range("check_val") = "Failed" Then
MsgBox "validation failed."
returnValue = True
End If
ChkValidation = returnValue
End Function
Based on the return value, I need to activate my worksheet.
If Not ChkValidation = False Then GoTo endSub:
Sheets("Sheet1").Activate
MsgBox "Submission is active"
endSub:
Application.EnableEvents = True
'----------------------
Application.ScreenUpdating = True
When I run the logic, I see 'validation failed' when the return value is true. But, I am not having the sheet Activated when the return value is false.
Please let me if i am missing any logic. I tried adding Else after 'If Not ChkValidation = False Then GoTo endSub:'. That did not work either.
Thanks in advance
I am trying to Activate a worksheet based on a condition.The condition is the return value of a function.
Private Function ChkValidation()
Dim returnValue As Boolean
returnValue = True
If Range("check_val") = "Failed" Then
MsgBox "validation failed."
returnValue = True
End If
ChkValidation = returnValue
End Function
Based on the return value, I need to activate my worksheet.
If Not ChkValidation = False Then GoTo endSub:
Sheets("Sheet1").Activate
MsgBox "Submission is active"
endSub:
Application.EnableEvents = True
'----------------------
Application.ScreenUpdating = True
When I run the logic, I see 'validation failed' when the return value is true. But, I am not having the sheet Activated when the return value is false.
Please let me if i am missing any logic. I tried adding Else after 'If Not ChkValidation = False Then GoTo endSub:'. That did not work either.
Thanks in advance