Hello ,
I don`t find a solution which is working in a situation. I have two sheets, let`s say A and B. In sheet A i have a button that it sends me to sheet B. When i click on the button i need to receive an InputBox where to enter my name. Everything is ok until now. If i just click ok or cancel with or without enter something in the Inputbox the sheet B is opened.
The question is, how can prevent no data input ? If nothing is entered i want to don`t be able to go to the next sheet. I have tried two ways but without success. Can you help me with an idea ?
Thank you !
And the second code
I don`t find a solution which is working in a situation. I have two sheets, let`s say A and B. In sheet A i have a button that it sends me to sheet B. When i click on the button i need to receive an InputBox where to enter my name. Everything is ok until now. If i just click ok or cancel with or without enter something in the Inputbox the sheet B is opened.
The question is, how can prevent no data input ? If nothing is entered i want to don`t be able to go to the next sheet. I have tried two ways but without success. Can you help me with an idea ?
Thank you !
VBA Code:
SUB NAME()
Dim myName As Variant
myName = InputBox("Whats your name?", "INFORMATII")
Worksheets("sheetB").Range("A1").Value = myName
If IsEmpty(Worksheets("sheetB").Range("A1").Value) = True Then
Worksheets("sheetB").Activate
Else
Worksheets("sheetA").Activate
END SUB
And the second code
VBA Code:
SUB NAME()
Dim myName As Variant
myName = InputBox("Whats your name?", "INFORMATII")
Worksheets("sheetB").Range("A1").Value = myName
If myName <> False Then
Worksheets("sheetB").Activate
Else
Worksheets("sheetA").Activate
END SUB