View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Compare strings of data

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(xl up))
End With

With Worksheets("DIR")
set rng1 = .Range(.Cells(1,"E"),.Cells(rows.count,"E").End(xl up))
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

--
Regards,
Tom Ogilvy


"Hal" wrote in message
...
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