Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2004
    Posts
    3

    Unanswered: This should be easy... Excel cell compare

    I need to search a spreadsheet one column ata atime looking for specific values in each column. If the value exista at all, I need a value set to true. This is what I have...

    Columns("I:I").Select
    bOK = False
    For bp = 1 To intRowRange
    If Cells(bp).Value = "60" Then
    bOK = True
    Exit For
    End If
    Next bp

    It processes, but I do not think it is searching clomn I like it is supposed to because the value 60 does exist and yet the boolean value is still returned as false. Any way I can make this work?

  2. #2
    Join Date
    Jan 2004
    Location
    Aberdeen, Scotland
    Posts
    1,067

    Re: This should be easy... Excel cell compare

    Hi Bill

    I dont know if this is the best way to do this or not but this routine will work

    Code:
        Lastrow = Range("A1").End(xlDown).Row
        Range("I1").Select
    bok =false
        For I = 1 To Lastrow
            If ActiveCell.Formula = "60" Then
                bok = True
                Exit For
            End If
            ActiveCell.Offset(1, 0).Select
        Next I
    ive tested this and it finds the value the only assumption ive made is that all your rows in column A are filled up till the last row of data i hope this is of some help to you
    David

  3. #3
    Join Date
    Jan 2004
    Location
    The Netherlands
    Posts
    421
    For one thing you should search for 60 (number) not "60" text.

Posting Permissions

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