Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 37
Default If no list exists, exit sub

I need help with the syntax on a conditional statement in a macro.
The macro works perfectly if a list (filtered list) exists. However,
if no lists exist on the page, I get an error message. I want to
start my code with a condition that does the following:

If no list exists
Exit sub
Else
...........

I can take it from there. Any help would be very much appreciated.

Kevin

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,090
Default If no list exists, exit sub

Kevin
It's going to be up to you to decide what constitutes "no list".
Something like "there's no entries in range such and such", or if there is
no entry in this cell or that cell or whatever.
For instance, let's say the list would be in A1:A10 if there is a list. The
following line of code would exit the sub if nothing is in that range.
If Application.CountA(Range("A1:A10")) = 0 Then Exit Sub
HTH Otto
"DoooWhat" wrote in message
oups.com...
I need help with the syntax on a conditional statement in a macro.
The macro works perfectly if a list (filtered list) exists. However,
if no lists exist on the page, I get an error message. I want to
start my code with a condition that does the following:

If no list exists
Exit sub
Else
..........

I can take it from there. Any help would be very much appreciated.

Kevin



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 37
Default If no list exists, exit sub

Sorry, I guess my initial inquiry was a little ambiguous. Let's
assume that there is ALWAYS data in the target range. When I refer to
a list, I am talking about when you highlight a range, then go to Data
\List\Create List.

Kevin

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
Show it here, if it exists there Kevin Excel Discussion (Misc queries) 5 July 28th 07 06:21 PM
how do i omit the a list, and it's matches, so neither exists? markcjr Excel Worksheet Functions 3 January 31st 07 01:46 AM
A value exists in a list? Alberto Pinto Excel Discussion (Misc queries) 1 May 16th 06 10:43 PM
how to copy old price data onto new stock list if match exists? julan Excel Discussion (Misc queries) 2 June 28th 05 03:49 PM
Sheet name already exists eddie_zoom Excel Discussion (Misc queries) 1 March 11th 05 02:53 PM


All times are GMT +1. The time now is 12:34 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"