ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macro runs only if cell not blank (https://www.excelbanter.com/excel-programming/429925-macro-runs-only-if-cell-not-blank.html)

Peterzh193 via OfficeKB.com

macro runs only if cell not blank
 
want a macro that refuses to run if cell E3 is blank/empty

to run the macro correcty data must be in this cell but it is user error that
may leave it blank.....can i avoid this with a question (msgbox) as part of a
macro?

--
Message posted via http://www.officekb.com


JLGWhiz[_2_]

macro runs only if cell not blank
 
You can use an If...Then statement to control the macro.

Sub runMacro()
If Range("E3") = "" Then
Exit Sub
End If
'The rest of your macro here
End Sub



"Peterzh193 via OfficeKB.com" <u52491@uwe wrote in message
news:97b1381880940@uwe...
want a macro that refuses to run if cell E3 is blank/empty

to run the macro correcty data must be in this cell but it is user error
that
may leave it blank.....can i avoid this with a question (msgbox) as part
of a
macro?

--
Message posted via http://www.officekb.com





All times are GMT +1. The time now is 05:11 AM.

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