+ Reply to Thread
Results 1 to 6 of 6

Value compared to a range of values

  1. #1
    Registered User
    Join Date
    04-04-2011
    Location
    Riga
    MS-Off Ver
    Excel 2007
    Posts
    11

    Value compared to a range of values

    Hello,
    I am trying to compare a value to a range of values. I have many to compare to so AND is not an option, writing is too long, unless it is possible to put in an AND many values. And I can't use for loop to do something like Range("H"& integer).Value This is my shortened code that does not work because of the way I write Range syntax there:

    Please Login or Register  to view this content.
    Last edited by skazis; 04-06-2011 at 01:10 PM.

  2. #2
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Value compared to a range of values

    hi, skazis, can you post a sample workbook showing your original data and the the result you need to obtain?

  3. #3
    Registered User
    Join Date
    04-04-2011
    Location
    Riga
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Value compared to a range of values

    In H column there are only numbers in cells, no blank cells. Like,
    H1=5
    H2=40
    H3=41
    ...
    H100=30

    What I need is to ta loop trough X and if a particular X equals to any of these H column values then I skip this this X and continue to next, else I do my code.

  4. #4
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Value compared to a range of values

    this is one of the ways it can be done:

    Please Login or Register  to view this content.
    Last edited by watersev; 04-06-2011 at 08:26 AM.

  5. #5
    Registered User
    Join Date
    04-04-2011
    Location
    Riga
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Value compared to a range of values

    Thank you very much. Programming takes a lot of imagination, I hope I'll I have it there since it has been only 3 days for me in VBA

  6. #6
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Value compared to a range of values

    if you are happy with the outcome and the issue is solved please mark the thread as solved: Click the Edit button on your first post in the thread, Click Go Advanced, select [SOLVED] from the Prefix dropdown, then click Save Changes

+ 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