LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default Problem using Match on columns of numbers with leading zeroesformatted as text ???

In my test run, I was using a column of first names in workbook A to
check and flag their
presence in workbook B, The code given to me by Marcus here worked
fine. No problem at all.
..
When I switched to the real problem by replacing my columns of data
with numbers
with leading zeroes, the columns being already formatted as text, the
program did not find Matches.
..
In both workbooks columns of data, cells have an automatic Excel
comment that says :
"The number in this cell is formatted as text or preceded by an
apostrophe".
..
What am I missing here ?
Is there a special care to be taken when using numbers with leading
zeroes in a cell formatted as text ?
Here is the code :

Sub FlagMatchingRecords()
Dim RngCell As Range
Dim IsMatch() As Variant
Dim res As Variant
Dim lw As Long
Dim lr As Long
Dim X As Range
Dim wb As Workbook
Dim ws As Worksheet
lr = Range("B" & Rows.Count).End(xlUp).Row
Set wb = Workbooks("B.xls")
Set ws = wb.Sheets("Sheet1")
IsMatch() = Range("B1:B" & lr).Value
lw = ws.Range("A" & Rows.Count).End(xlUp).Row


Set X = ws.Range("A1:A" & lw)
For Each RngCell In X
MsgBox RngCell.Value
res = Application.Match(RngCell.Value, IsMatch, 0)
If IsError(res) Then
'No Match
Else ' Match
RngCell.Interior.Color = vbYellow
End If
Next RngCell
End Sub

Help appreciated,

J.P.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
TEXT TO COLUMNS WITH LEADING ZEROS Peggy Excel Discussion (Misc queries) 6 April 27th 23 03:45 AM
Mix text and numbers with leading zeros Susan B Excel Worksheet Functions 3 September 17th 08 11:03 PM
Text with leading zeros being converted to numbers Brian Excel Programming 2 June 21st 07 08:47 PM
Remove leading Numbers from text DBLWizard Excel Worksheet Functions 2 March 31st 05 11:08 PM
numbers and text in Excel to read as text keeping the leading zer. Ralph Excel Discussion (Misc queries) 2 December 10th 04 07:05 PM


All times are GMT +1. The time now is 10:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"