+ Reply to Thread
Results 1 to 3 of 3

Help to find a value in an array

  1. #1
    Registered User
    Join Date
    05-09-2012
    Location
    Tampa, FL, USA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Help to find a value in an array

    Hi:

    I'm trying to write a macro to find a value in a column and get some data from it's row. The value can be repeated several times. I wrote the following macro, but it's working only to find the first value. After that I'm getting this error:

    Run-time error '1004':
    Method 'Range' of object '_Global' failed

    Really I don't know what is going on. I'll appreciate any help.

    Thanks

    Armando
    Please Login or Register  to view this content.
    Last edited by Leith Ross; 05-09-2012 at 02:32 PM. Reason: Added Code Tags

  2. #2
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: Help to find a value in an array

    You gave the error number, but you didn't specify the line where the error occurred.

    Instead of:

    Please Login or Register  to view this content.
    Perhaps something like:

    Please Login or Register  to view this content.
    The find method returns the Cell/Range of the first cell in a given Range that satisfies a criterion.

    Then you need to find out if this Range is not nothing, although it has to be written:
    Please Login or Register  to view this content.
    Last edited by StevenM; 05-09-2012 at 03:05 PM.

  3. #3
    Registered User
    Join Date
    05-09-2012
    Location
    Tampa, FL, USA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Help to find a value in an array

    Thanks StevenM, it works similar to the original code. When I find the first value I need to set a new range in order to find the second one, for that reason I'm using Cell1 and Cell 2 as a range. When the range is set form the first row number found untill the last row in the range, I'm getting the same error.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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