View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
anilsolipuram[_77_] anilsolipuram[_77_] is offline
external usenet poster
 
Posts: 1
Default Matching values in 1 column to data in another


Backup your workbook before trying this macro


you can change the searching text by changing search_text variabl
value.


try it and let me know
Sub Macro1()
Dim INIT, I, t, incr, search_text As Variant
I = 0
Columns("g:g").Select
On Error GoTo a:
search_text = "IWEC44332"
Selection.Find(What:=search_text, After:=ActiveCell, LookIn:=xlFormula
_
, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Activate
INIT = ActiveCell.Address
Range("h" & ActiveCell.Row).Value = Range("f" & ActiveCell.Row).Value
While I = 0
Selection.FindNext(After:=ActiveCell).Activate
If ActiveCell.Address = INIT Then
I = 1
Else
Range("h" & ActiveCell.Row).Value = Range("f" & ActiveCell.Row).Value
End If
Wend
a:
If Err.Description < "" Then
MsgBox "no match found"
End If

End Su

--
anilsolipura
-----------------------------------------------------------------------
anilsolipuram's Profile: http://www.excelforum.com/member.php...fo&userid=1627
View this thread: http://www.excelforum.com/showthread.php?threadid=38030