Hi.
I am attaching two files.
File Book1 has values in Column A.
These values are to be looked up in File Nifty All Column A and Highlight that cell in green color.
Please if possible.
Hi.
I am attaching two files.
File Book1 has values in Column A.
These values are to be looked up in File Nifty All Column A and Highlight that cell in green color.
Please if possible.
The only way to do that would be to search for each entry in the other book. This would be very slow depending on how many names are listed.
Open both WorkBooks.
Click the button in Book1
Great work.
Its working absolutely fine.
You are wonderful Roy
Pleased to help.
Post back if you need further help.
Visit my web site, http://www.excel-it.com, for more examples and some helpful articles.
Open both WorkBooks.
Click the button in Book1
Hi Roy,
This VBA highlights only one cell of particular name.
Actually there maybe more than 1 cells matching, so can it highlight all the matching cell of that particular name.
Check this
Sub Findmatches()
Dim rCl As Range, rFnd As Range, rSrc As Range
Dim FirstFnd As String
Set rSrc = Workbooks("Nifty All.xlsx").Sheets(1).Range("A1").CurrentRegion
For Each rCl In ThisWorkbook.Sheets("Sheet1").Range("A1").CurrentRegion.Columns(1).Cells
Set rFnd = rSrc.Find(rCl.Value)
If Not rFnd Is Nothing Then
FirstFnd = rFnd.Address
Do
rFnd.Interior.Color = vbGreen
Set rCl = rSrc.FindNext(rCl)
Loop While Not rCl Is Nothing
End If
Next rCl
End Sub
Display More
Hi Roy,
Thanks for your response.
It's not working.
Just highlighting one cell and hangs up.
Check this
CodeDisplay MoreSub Findmatches() Dim rCl As Range, rFnd As Range, rSrc As Range Dim FirstFnd As String Set rSrc = Workbooks("Nifty All.xlsx").Sheets(1).Range("A1").CurrentRegion For Each rCl In ThisWorkbook.Sheets("Sheet1").Range("A1").CurrentRegion.Columns(1).Cells Set rFnd = rSrc.Find(rCl.Value) If Not rFnd Is Nothing Then FirstFnd = rFnd.Address Do rFnd.Interior.Color = vbGreen Set rCl = rSrc.FindNext(rCl) Loop While Not rCl Is Nothing End If Next rCl End Sub
Attach your workbook
Attach your workbook
Please find attached
Attach your workbook
Please find attached
Where you able to work on it
I'll look at it as soon as I get chance.
This should work
Sub FindmatchesAll()
Dim rCl As Range, rFnd As Range, rSrc As Range
Dim FirstFnd As String
Set rSrc = Workbooks("Nifty All.xlsx").Sheets(1).Range("A1").CurrentRegion
For Each rCl In ThisWorkbook.Sheets("Sheet1").Range("A1").CurrentRegion.Columns(1).Cells
With rSrc.Cells
Set rFnd = rSrc.Find(rCl.Value)
If Not rFnd Is Nothing Then
FirstFnd = rFnd.Address
Do
rFnd.Interior.Color = vbGreen
Set rFnd = .FindNext(rFnd)
Loop While Not rFnd Is Nothing And rFnd.Address <> FirstFnd
End If
End With
Next rCl
End Sub
Display More
This should work
CodeDisplay MoreSub FindmatchesAll() Dim rCl As Range, rFnd As Range, rSrc As Range Dim FirstFnd As String Set rSrc = Workbooks("Nifty All.xlsx").Sheets(1).Range("A1").CurrentRegion For Each rCl In ThisWorkbook.Sheets("Sheet1").Range("A1").CurrentRegion.Columns(1).Cells With rSrc.Cells Set rFnd = rSrc.Find(rCl.Value) If Not rFnd Is Nothing Then FirstFnd = rFnd.Address Do rFnd.Interior.Color = vbGreen Set rFnd = .FindNext(rFnd) Loop While Not rFnd Is Nothing And rFnd.Address <> FirstFnd End If End With Next rCl End Sub
It worked Perfectly as your magic works always.
Thanks a Lot.
Pleased to help.
Don’t have an account yet? Register yourself now and be a part of our community!