I.... Think i'm understanding the MATCH statement correctly but how do i use a variable within a MATCH statement or am i trying to get the MATCH statement to do something it cant?
Initial Code:
Private Sub cntrct1()
Sheets("totals").Activate
Dim y As Integer
Dim z As Integer
Dim prod As String
Dim prod0 As String
y = WorksheetFunction.CountA(Worksheets("contracts").Range(Worksheets("contracts").Cells(2, 1), Worksheets("contracts").Cells(999, 1)))
prod = Sheets("contracts").Cells(2, 1)
Cells(2, 6) = WorksheetFunction.Match(prod.Value, Range(Worksheets("contracts").Cells(2, 1), Worksheets("contracts").Cells(y, 1), 0))
' check status only for testing
Cells(4, 10) = prod
Cells(4, 11) = y
End Sub
What i'm trying to do is retrieve the value of a cell where the the variable from 'totals' matches the variable in 'contracts', this would loop so until all variables have been matched from the 'totals' worksheet. (at the moment i'm trying to get it to match one and then i'll get to the rest)
Thanks In Advance,
o/
Initial Code:
Private Sub cntrct1()
Sheets("totals").Activate
Dim y As Integer
Dim z As Integer
Dim prod As String
Dim prod0 As String
y = WorksheetFunction.CountA(Worksheets("contracts").Range(Worksheets("contracts").Cells(2, 1), Worksheets("contracts").Cells(999, 1)))
prod = Sheets("contracts").Cells(2, 1)
Cells(2, 6) = WorksheetFunction.Match(prod.Value, Range(Worksheets("contracts").Cells(2, 1), Worksheets("contracts").Cells(y, 1), 0))
' check status only for testing
Cells(4, 10) = prod
Cells(4, 11) = y
End Sub
What i'm trying to do is retrieve the value of a cell where the the variable from 'totals' matches the variable in 'contracts', this would loop so until all variables have been matched from the 'totals' worksheet. (at the moment i'm trying to get it to match one and then i'll get to the rest)
Thanks In Advance,
o/