ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Stop a Macro if no Data found (https://www.excelbanter.com/excel-programming/377015-stop-macro-if-no-data-found.html)

tedd13

Stop a Macro if no Data found
 
I have a macro that imports a text file. Sometimes the text file contains no
data. I have the macro display a messge box saying that there is no data.
What I would like is for the macro to stop when the user clicks OK on the
message box.

Does anyone know the code for that?

Thanks

Snake Plissken[_2_]

Stop a Macro if no Data found
 
variable = [check how many rows were imported]
if variable = 0 then
msgbox "blabla"
exit sub
end if




All times are GMT +1. The time now is 08:10 PM.

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