Excel if and else statement

  • Thread starter Thread starter millwalll
  • Start date Start date
M

millwalll

Hi all need some help


Problem
I have a excel page and I want the user to enter his/her name in cell b4. I
want to validate this by saying if there is nothing entered in that field
they get a pop up saying enter your name please. If their name is entered I
want it to carry on running at the moment it seem to tell them to enter
their name even if they have entered it.


If Sheet2.Range("b4").Value = "" Then
MsgBox ("Please enter your Name")
Else: Sheet2.Range("a2").Value = (Sheet1.Range("b4").Value
end if


any help would be amazing thanks guys/girls ....
 
What you have there does not even compile. Does this work for you...

If Sheet2.Range("b4").Value = "" Then
MsgBox ("Please enter your Name")
Else
Sheet2.Range("a2").Value = Sheet1.Range("b4").Value
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top