ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Matching values in 1 column to data in another (https://www.excelbanter.com/excel-programming/332204-re-matching-values-1-column-data-another.html)

anilsolipuram[_77_]

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



All times are GMT +1. The time now is 04:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com