If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > This should be easy... Excel cell compare

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-25-04, 02:21
billprozac billprozac is offline
Registered User
 
Join Date: Jan 2004
Posts: 3
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?
Reply With Quote
  #2 (permalink)  
Old 01-26-04, 07:56
DavidCoutts DavidCoutts is offline
Registered User
 
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
Reply With Quote
  #3 (permalink)  
Old 01-26-04, 08:40
namliam namliam is offline
Registered User
 
Join Date: Jan 2004
Location: The Netherlands
Posts: 421
For one thing you should search for 60 (number) not "60" text.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On