ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   If statement to stop macro (https://www.excelbanter.com/excel-programming/333224-if-statement-stop-macro.html)

AK

If statement to stop macro
 
Running a macro to basically rearrange data. However if there is no data, i
receive and error.

Can I use an If statement to check a cell and if blank or "0" to stop macro?

Thanks in advance

Harald Staff

If statement to stop macro
 
Yes you can.

If Range("A1").Value = 0 Then Exit Sub

HTH. Best wishes Harald

"AK" skrev i melding
...
Running a macro to basically rearrange data. However if there is no data,

i
receive and error.

Can I use an If statement to check a cell and if blank or "0" to stop

macro?

Thanks in advance




AK

If statement to stop macro
 
How do you get a Msg box to show up with "Comments"?

Thanks

"Harald Staff" wrote:

Yes you can.

If Range("A1").Value = 0 Then Exit Sub

HTH. Best wishes Harald

"AK" skrev i melding
...
Running a macro to basically rearrange data. However if there is no data,

i
receive and error.

Can I use an If statement to check a cell and if blank or "0" to stop

macro?

Thanks in advance





Norman Jones

If statement to stop macro
 
Hi AK,

Try:

Sub MyMessageComments()

MsgBox "Comments: This question has no obvious nexus " & _
"with the subject used in your post" & vbNewLine & _
"In cases like this, it is most beneficial to you, and" _
& "courteous to others, to initiate a new thread." & _
vbNewLine & "Perhaps a suitable title for your new " & _
"thread might be ""How can I run a MsgBox""", _
Title:="A Friendly Tip"

End Sub


---
Regards,
Norman



"AK" wrote in message
...
How do you get a Msg box to show up with "Comments"?

Thanks

"Harald Staff" wrote:

Yes you can.

If Range("A1").Value = 0 Then Exit Sub

HTH. Best wishes Harald

"AK" skrev i melding
...
Running a macro to basically rearrange data. However if there is no
data,

i
receive and error.

Can I use an If statement to check a cell and if blank or "0" to stop

macro?

Thanks in advance








All times are GMT +1. The time now is 07:36 PM.

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