ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   vba question.. matching in columns (https://www.excelbanter.com/excel-programming/288532-vba-question-matching-columns.html)

yonnuta

vba question.. matching in columns
 
I am trying to take a cell and find the match within a row, then tak
another cell and find a match within a column and finally take th
intersection of that row and column where the matches were found.
can find the intersection of two ranges, the match in a given column
but I cant get the row version (see below) to work, nor am i sure ho
to tie these three functions together. Any ideas? Thx

Can anyone help me accomplish this?
I've got this far:
'this function returns the VALUE at the intersection of two ranges
Function intersectvalue(a As Range, b As Range)
Dim commoncells As Range
On Error Resume Next
Set commoncells = Intersect(a, b)
If Err.Number = 0 Then intersectvalue = commoncells.Address Els
cellsincommon = 0

End Function

'trys to find a match within a column
Function matchcol(a As Range, b As Range)
For counter = 78 To 88
Set curcell = b.Worksheet.Cells(counter, b.Column)
If InStr(1, a.Text, curcell.Text) Then matchcol = curcell.Address

Next counter
End Function

'trys to find a match within a ROW
Function matchrow(a As Range, b As Range)
For counter = 3 To 6
Set curcell = b.Worksheet.Cells(b.Row, counter)
If InStr(1, a.Text, curcell.Text) Then matchrow = curcell.Address

Next counter
End Functio

--
Message posted from http://www.ExcelForum.com



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

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