+ Reply to Thread
Results 1 to 4 of 4

Error checking for Variant Arrays?

  1. #1
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Error checking for Variant Arrays?

    I have a function which will create arrays from worksheets. I am pushing a few sheets through this function and then I run some code on the array that was built.

    Now for the problem. Some sheets are empty so the function doesn't build an array. How do I note this so that the next code called doesn't try to process the array?

    I have already tried reworking the function so that it will set the variant array to Empty and then in the 'DoSomethingToArray' code, exit the sub if the input array is Empty. However this doesn't work because I get a "Type Mismatch" error message on the variant = Empty.

    Any ideas on how to work around this?
    Last edited by mc84excel; 05-13-2013 at 05:51 AM.
    *******************************************************

    HELP WANTED! (Links to Forum threads)
    Trying to create reusable code for Custom Events at Workbook (not Application) level

    *******************************************************

  2. #2
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Error checking for Variant Arrays?

    I have worked out an alternative solution to the practical problem I had. (My alternative solution was to have code prior to the "BuildArray" function to check if the worksheet was empty or not. If not, then go to the next in loop.

  3. #3
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Error checking for Variant Arrays?

    pretty hard to assist in questions like this if you don't post any code ;-)
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  4. #4
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Error checking for Variant Arrays?

    Quote Originally Posted by JosephP View Post
    pretty hard to assist in questions like this if you don't post any code ;-)
    True. Sorry

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1