Ulisses_Carso
New Member
- Joined
- Sep 4, 2020
- Messages
- 39
- Office Version
- 365
- Platform
- Windows
Hello guys!
First things first, english isn't my main language so, i'm sorry about any misunderstanding
I have a Main Sub "TVP" with a msgbox condition and two Subs "FillBlank" and "SearchPlate", if user clicks yes it will call first Sub "FillBlank".
Inside "FillBlank" i have another msgbox condition, and again if user clicks yes, the Macro runs, comeback to Sub "TVP" and calls the other sub "SearchPlate".
But, if user click on Cancel button, that Sub Ends and still comeback to Sub "TVP" and run he second Sub.
This is the problem, it can't happen, if the user clicks the Cancel button everything should end. Is there a way to detect in the main Sub if the user clicks the Cancel button of the Sub "FillBlank" on any moment?
Sub TVP()
pergunta = MsgBox("Corrigiu os zeros dos carros novos?", vbQuestion + vbYesNo + vbDefaultButton2, "Macro TVP")
If pergunta = vbYes Then
FillBlank
SearchPlate
Else
End
End If
End Sub
Private Sub FillBlank()
Worksheets("tvp-ago").Activate
Dim InputValue As String
InputValue = InputBox("Digite o valor para preencher a célula em branco:", "Preencher Célula")
If StrPtr(result) <> 0 Then
For Each cell In Selection
If IsEmpty(cell) Then
cell.Value = InputValue
End If
Next
Else
End If
End Sub
Private Sub SearchPlate()
MsgBox ("Didn't worked")
End Sub
First things first, english isn't my main language so, i'm sorry about any misunderstanding
I have a Main Sub "TVP" with a msgbox condition and two Subs "FillBlank" and "SearchPlate", if user clicks yes it will call first Sub "FillBlank".
Inside "FillBlank" i have another msgbox condition, and again if user clicks yes, the Macro runs, comeback to Sub "TVP" and calls the other sub "SearchPlate".
But, if user click on Cancel button, that Sub Ends and still comeback to Sub "TVP" and run he second Sub.
This is the problem, it can't happen, if the user clicks the Cancel button everything should end. Is there a way to detect in the main Sub if the user clicks the Cancel button of the Sub "FillBlank" on any moment?
Sub TVP()
pergunta = MsgBox("Corrigiu os zeros dos carros novos?", vbQuestion + vbYesNo + vbDefaultButton2, "Macro TVP")
If pergunta = vbYes Then
FillBlank
SearchPlate
Else
End
End If
End Sub
Private Sub FillBlank()
Worksheets("tvp-ago").Activate
Dim InputValue As String
InputValue = InputBox("Digite o valor para preencher a célula em branco:", "Preencher Célula")
If StrPtr(result) <> 0 Then
For Each cell In Selection
If IsEmpty(cell) Then
cell.Value = InputValue
End If
Next
Else
End If
End Sub
Private Sub SearchPlate()
MsgBox ("Didn't worked")
End Sub