Compare strings of data

G

Guest

Greetings once again,

I have a workbook which has one sheet that contains data from a statistical
database. Another sheet is said workbook contains a DIR listing of the Raw
data files from which the data is sent to the database. (See the example
below.)

I would like to use the raw data file name in column E 'left(Ex,10)' from
the DIR sheet and determine if that string exists in the SPC sheet column G.
If the string does not exist in column G, I want to BOLD the Ex cell in the
DIR sheet.

I wish I knew a programmer that I could sit down with to build this code,
but I ask for your help to get me through this task.

Regards and thanks in advance

Hal in Detroit

(EXAMPLE)
F G H I
1 GREEN UNIT_NUMBER Date Time
2 Y 5262002058 9/26/2005 4:54:36 PM
3 Y 5262002047 9/26/2005 7:18:59 AM
4 N 5262002048 9/25/2005 5:41:21 PM
5 N 5262002048 9/25/2005 10:00:56 AM


B C D E
3 5:43 PM 23,117 526200205827001855.dat
4 8:13 AM 23,247 526200204726954287.dat
5 6:36 PM 56,632 526200204826885643.dat
 
T

Tom Ogilvy

Sub AA()
Dim rng as Range, rng1 as Range
Dim cell as Range
Dim lNum as Long, res as Variant, res1 as Variant

With Worksheets("SPC")
set rng = .Range(.Cells(2,"G"),.Cells(rows.count,"G").End(xlup))
End With

With Worksheets("DIR")
set rng1 = .Range(.Cells(1,"E"),.Cells(rows.count,"E").End(xlup))
End With
rng1.font.Bold = False
for each cell in rng1
lNum = clng(left(cell.Value,10))
res = Application.Match(lNum,rng,0)
res1 = Application.Match(cStr(lNum),rng,0)
if iserror(res) and iserror(res1) then
cell.Font.bold = True
end if
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top