ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Message box if cell is left empty when run? (https://www.excelbanter.com/excel-programming/368965-message-box-if-cell-left-empty-when-run.html)

nbaj2k[_20_]

Message box if cell is left empty when run?
 

Right now I have 2 cells in the top left of my spreadsheet that are se
to be parameters. One is the start date and one is the end date.
would like to know if there is a way to have a message box come up i
someone tries to run the macro without having a date in the box
instead of having it error out.

I know there is a way and it would be an If statement, but not sure ho
it would be written.

Thanks,

~

--
nbaj2
-----------------------------------------------------------------------
nbaj2k's Profile: http://www.excelforum.com/member.php...fo&userid=3648
View this thread: http://www.excelforum.com/showthread.php?threadid=56698


ImpulseBlue

Message box if cell is left empty when run?
 
say range 1 and 2 are on Sheet1, "A1" and "A2"...

'Check for start date
If Sheet1.Range("A1") = "" OR (Not IsDate(Sheet1.Range("A1")) then
'Flag message and exit routine
end if

Then do same for end date.

nbaj2k wrote:
Right now I have 2 cells in the top left of my spreadsheet that are set
to be parameters. One is the start date and one is the end date. I
would like to know if there is a way to have a message box come up if
someone tries to run the macro without having a date in the box,
instead of having it error out.

I know there is a way and it would be an If statement, but not sure how
it would be written.

Thanks,

~J


--
nbaj2k
------------------------------------------------------------------------
nbaj2k's Profile: http://www.excelforum.com/member.php...o&userid=36480
View this thread: http://www.excelforum.com/showthread...hreadid=566989



nbaj2k[_21_]

Message box if cell is left empty when run?
 

thanks! exactly what I needed.

~J


--
nbaj2k
------------------------------------------------------------------------
nbaj2k's Profile: http://www.excelforum.com/member.php...o&userid=36480
View this thread: http://www.excelforum.com/showthread...hreadid=566989



All times are GMT +1. The time now is 12:54 AM.

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