View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default Excel if and else statement

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

--
HTH...

Jim Thomlinson


"millwalll" wrote:

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 ....