Stop a Macro if no Data found

G

Guest

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
 
S

Snake Plissken

variable = [check how many rows were imported]
if variable = 0 then
msgbox "blabla"
exit sub
end if
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top