ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Ending a macro early conditionally on one cell being blank (https://www.excelbanter.com/excel-discussion-misc-queries/90704-ending-macro-early-conditionally-one-cell-being-blank.html)

Rokuro kubi

Ending a macro early conditionally on one cell being blank
 
How do I get the macro to end itself once all the data has been taken
elsewhere?

If IsEmpty("Q2") Then Exit Sub?
Else 'do nothing - it's still got data I want it to continue the macro
End If? 'here there is an error message of "End If without Block If"


Kevin B

Ending a macro early conditionally on one cell being blank
 
How about trying:

If Range("Q2").value = "" then Exit Sub
--
Kevin Backmann


"Rokuro kubi" wrote:

How do I get the macro to end itself once all the data has been taken
elsewhere?

If IsEmpty("Q2") Then Exit Sub?
Else 'do nothing - it's still got data I want it to continue the macro
End If? 'here there is an error message of "End If without Block If"



Gary''s Student

Ending a macro early conditionally on one cell being blank
 
Sub Macro1()
If IsEmpty(Range("Q2").Value) Then
Exit Sub
End If
End Sub
--
Gary''s Student


"Rokuro kubi" wrote:

How do I get the macro to end itself once all the data has been taken
elsewhere?

If IsEmpty("Q2") Then Exit Sub?
Else 'do nothing - it's still got data I want it to continue the macro
End If? 'here there is an error message of "End If without Block If"



Rokuro kubi

Ending a macro early conditionally on one cell being blank
 
Great, cheers guys.



All times are GMT +1. The time now is 03:19 AM.

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