lifeson
06-27-2008, 11:08 PM
I use this to find which row contains the data I am looking for
With wsTree
r = .Cells(Rows.Count, "A").End(xlUp).Row
.Select
Select Case key
Case 1
f = Application.WorksheetFunction.Match(compID, wsTree.Columns(6), 0)
' MsgBox "component " & compID & " is on row " & f
.Cells(f, "H").Value = Price
Case 2
f = Application.WorksheetFunction.Match(packID, wsTree.Columns(6), 0)
MsgBox "Pack " & packID & " is on row " & f
.Cells(f, "H").Value = Price
End Select
End With
This works fine for items such as ABC123 etc
f= Application.WorksheetFunction.Match(compID, wsTree.Columns(6), 0)
But using the same routine but for a packID
f = Application.WorksheetFunction.Match(packID, wsTree.Columns(6), 0)
which can be either an alphanumeric mix or numeric only it gives the error "unable to get the match property of the worksheet function"
packID is a string, I have tried it as a variant aswell and still get the same problem.:banghead:
With wsTree
r = .Cells(Rows.Count, "A").End(xlUp).Row
.Select
Select Case key
Case 1
f = Application.WorksheetFunction.Match(compID, wsTree.Columns(6), 0)
' MsgBox "component " & compID & " is on row " & f
.Cells(f, "H").Value = Price
Case 2
f = Application.WorksheetFunction.Match(packID, wsTree.Columns(6), 0)
MsgBox "Pack " & packID & " is on row " & f
.Cells(f, "H").Value = Price
End Select
End With
This works fine for items such as ABC123 etc
f= Application.WorksheetFunction.Match(compID, wsTree.Columns(6), 0)
But using the same routine but for a packID
f = Application.WorksheetFunction.Match(packID, wsTree.Columns(6), 0)
which can be either an alphanumeric mix or numeric only it gives the error "unable to get the match property of the worksheet function"
packID is a string, I have tried it as a variant aswell and still get the same problem.:banghead: