It's probably an easy one but I'm kinda new to programming. I probably did some hard-coding beceause I don't know any better.
I would like to add an error message if the first If
statement isn't met. I will give you a simplified example of my code. If you want the actual code, let me know and I will edit my question (but careful, it's long!)
If CheckBox1.Value = True and CheckBox2.Value = False then
(CODE number 1)
Else
MsgBox ("error")
End If
If CheckBox1.Value = False and CheckBox2.Value = True then
(CODE numer 2)
Else
MsgBox("Error")
End if
The problem here is that the If
statements keeps coming and the code will run line by line. I am aware of that. But I just don't know any better. So I can't place any msgbox error because the code will keep running and execute the rest.
How Do I fragment theses lines so I can place any messagebox I want for each blocks of if
?
Sorry for my english.