Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Stop a Macro if no Data found

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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
return cells below stop when word found bwilk77 Excel Discussion (Misc queries) 1 April 2nd 09 05:50 PM
Stop a loop when certain data is found jsmith Excel Discussion (Misc queries) 3 June 2nd 08 10:12 PM
Stop the loop when found. hfazal Excel Programming 1 February 16th 06 11:57 PM
Stop Macro if there is no data STEVEB Excel Programming 13 February 8th 06 09:41 PM
Delete macro to stop importing data jgranda[_2_] Excel Programming 0 August 5th 04 02:59 PM


All times are GMT +1. The time now is 12:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"