Stop a Macro if no Data found

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
variable = [check how many rows were imported]
if variable = 0 then
msgbox "blabla"
exit sub
end if
 
Back
Top