ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Simple If Blank Statement (https://www.excelbanter.com/excel-programming/358005-simple-if-blank-statement.html)

bobwilson[_19_]

Simple If Blank Statement
 

This should be a simple if Statement. I want the below error message t
come up if cell A1 is blank. Otherwise(Else) populate data (I hav
excelued the balance of the code.)

namecl = ActiveSheet.Range("A1")

With ActiveSheet
If namecl = "" Then

msg = "Blank Entry. Cannot add Blank contact."
MsgBox msg, vbCritical, "Add New Contact"

Els

--
bobwilso
-----------------------------------------------------------------------
bobwilson's Profile: http://www.excelforum.com/member.php...fo&userid=3304
View this thread: http://www.excelforum.com/showthread.php?threadid=52968


Bob Phillips[_6_]

Simple If Blank Statement
 
Set namecl = ActiveSheet.Range("A1")

With ActiveSheet
If namecl.Value = "" Then

msg = "Blank Entry. Cannot add Blank contact."
MsgBox msg, vbCritical, "Add New Contact"

Else


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"bobwilson" wrote
in message ...

This should be a simple if Statement. I want the below error message to
come up if cell A1 is blank. Otherwise(Else) populate data (I have
excelued the balance of the code.)

namecl = ActiveSheet.Range("A1")

With ActiveSheet
If namecl = "" Then

msg = "Blank Entry. Cannot add Blank contact."
MsgBox msg, vbCritical, "Add New Contact"

Else


--
bobwilson
------------------------------------------------------------------------
bobwilson's Profile:

http://www.excelforum.com/member.php...o&userid=33046
View this thread: http://www.excelforum.com/showthread...hreadid=529682




Toppers

Simple If Blank Statement
 
Try

If Len(Trim(namecl)) = 0 Then

"bobwilson" wrote:


This should be a simple if Statement. I want the below error message to
come up if cell A1 is blank. Otherwise(Else) populate data (I have
excelued the balance of the code.)

namecl = ActiveSheet.Range("A1")

With ActiveSheet
If namecl = "" Then

msg = "Blank Entry. Cannot add Blank contact."
MsgBox msg, vbCritical, "Add New Contact"

Else


--
bobwilson
------------------------------------------------------------------------
bobwilson's Profile: http://www.excelforum.com/member.php...o&userid=33046
View this thread: http://www.excelforum.com/showthread...hreadid=529682




All times are GMT +1. The time now is 02:53 PM.

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