I am getting an error message "Unable to get Vlookup Property of WorksheetFunction class". Below is the code I am trying to use. I have just about every reference added that I can think of. Does anyone have an idea of what I am doing wrong? Please help, I'm desperate to turn a 3 day task into a 1/2 hour task.
thanks
c2
Global x, y, iComponentRow, iThiscolumn As Integer
Global dDemand As Double
Global sPartAddress As String
Global strStartMatl As String
Global aryComponent(10) As String
Sub GO()
Call FindPart
Call LoadArry
Call locateComponent
End Sub
Sub FindPart()
'
sFindCell = ActiveCell.Value
sPartAddress = ActiveCell.Address
Sheets("BKLOGTHRUDEC31050702 (3)".Select
Columns("A:A".Select
Range("A17".Activate
Selection.Find(What:=sFindCell, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Activate
End Sub
Sub LoadArry()
x = 1
ActiveCell.Offset(0, 4).Select
Do Until ActiveCell.Value = ""
aryComponent(x) = ActiveCell.Value
x = x + 1
ActiveCell.Offset(0, 1).Select
Loop
Sheets("mrp".Select
Range(sPartAddress).Select
End Sub
Sub locateComponent()
dDemand = ActiveCell.Offset(0, 1).Value
ActiveCell.Offset(0, 3).Select
iThisRow = ActiveCell.Row
iThiscolumn = ActiveCell.Column
iComponentRow = -1 * (ActiveRow - 4)
For y = 1 To x
Do Until Cells(iComponentRow, iThiscolumn).Value = "END"
If Cells(iComponentRow, iThiscolumn).Value = aryComponent Then
End If
iThiscolumn = ActiveCell.Column + 1
ActiveCell.Offset(0, 1).Select
Loop
Range(sPartAddress).Select
ActiveCell.Offset(0, 3).Select
iThiscolumn = ActiveCell.Column
Next y
End Sub
Sub Formula1()
Dim dTestValue As Double
' error is on this line
iComponentValue = Application.WorksheetFunction _
.VLookup(aryComponent, "'wafer inv'A:S", 19, False)
dTestValue = ActiveCell.Value
If dTestValue >= dDemand Then
ActiveCell.Value = dDemand
Else
If dTestValue < dDemand And dTestValue > 0 Then
ActiveCell.Value = dTestValue
Else
ActiveCell.Value = "xxx"
End If
End If
End Sub Craig Canter
Cost Accountant
Sipex
Milpitas, CA
thanks
c2
Global x, y, iComponentRow, iThiscolumn As Integer
Global dDemand As Double
Global sPartAddress As String
Global strStartMatl As String
Global aryComponent(10) As String
Sub GO()
Call FindPart
Call LoadArry
Call locateComponent
End Sub
Sub FindPart()
'
sFindCell = ActiveCell.Value
sPartAddress = ActiveCell.Address
Sheets("BKLOGTHRUDEC31050702 (3)".Select
Columns("A:A".Select
Range("A17".Activate
Selection.Find(What:=sFindCell, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Activate
End Sub
Sub LoadArry()
x = 1
ActiveCell.Offset(0, 4).Select
Do Until ActiveCell.Value = ""
aryComponent(x) = ActiveCell.Value
x = x + 1
ActiveCell.Offset(0, 1).Select
Loop
Sheets("mrp".Select
Range(sPartAddress).Select
End Sub
Sub locateComponent()
dDemand = ActiveCell.Offset(0, 1).Value
ActiveCell.Offset(0, 3).Select
iThisRow = ActiveCell.Row
iThiscolumn = ActiveCell.Column
iComponentRow = -1 * (ActiveRow - 4)
For y = 1 To x
Do Until Cells(iComponentRow, iThiscolumn).Value = "END"
If Cells(iComponentRow, iThiscolumn).Value = aryComponent Then
End If
iThiscolumn = ActiveCell.Column + 1
ActiveCell.Offset(0, 1).Select
Loop
Range(sPartAddress).Select
ActiveCell.Offset(0, 3).Select
iThiscolumn = ActiveCell.Column
Next y
End Sub
Sub Formula1()
Dim dTestValue As Double
' error is on this line
iComponentValue = Application.WorksheetFunction _
.VLookup(aryComponent, "'wafer inv'A:S", 19, False)
dTestValue = ActiveCell.Value
If dTestValue >= dDemand Then
ActiveCell.Value = dDemand
Else
If dTestValue < dDemand And dTestValue > 0 Then
ActiveCell.Value = dTestValue
Else
ActiveCell.Value = "xxx"
End If
End If
End Sub Craig Canter
Cost Accountant
Sipex
Milpitas, CA