View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
yonnuta[_2_] yonnuta[_2_] is offline
external usenet poster
 
Posts: 1
Default HARD PROBLEM! Need help stat!

I am trying to find the intersection in an array based on two value
that need to be matched in the first row and column of the array.

I've written the code to find the intersection and to make the match i
the row and column, but I can't seem to combine the three pieces o
code into one functional piece.

ANY IDEAS?! PLEASE HELP. Below is what i've written so far:

'this function returns the ADDRESS of the intersection of two ranges
Function cellsincommon(a As Range, b As Range)
Dim commoncells As Range
On Error Resume Next
Set commoncells = Intersect(a, b)
If Err.Number = 0 Then cellsincommon = commoncells.Address Els
cellsincommon = 0

End Function
'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 145
Set curcell = b.Worksheet.Cells(counter, b.Column)
' If InStr(1, a.Text, curcell.Text) Then matchcol = curcell.Addres
If 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 8
Set curcell = b.Worksheet.Cells(b.Row, counter)
' If InStr(1, a.Text, curcell.Text) Then matchrow = curcell.Value
If a.Text = curcell.Text Then matchrow = curcell.Address

Next counter
End Functio

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