ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel if and else statement (https://www.excelbanter.com/excel-programming/401605-excel-if-else-statement.html)

millwalll

Excel if and else statement
 
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 ....

Jim Thomlinson

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



All times are GMT +1. The time now is 08:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com