Hey
Theres a problem which i do not know how to fix. I've got most of the program i made working but i just cant get the VLOOKUP to work.
The program shall be used on multiple OS platforms (Win Vista, Win 7, Mac OS X 10). The excel version is 2007.
Anyway heres the code:
At first the formula on G column did not also work, but got it working via searching. All help is appreciated.
PS: Runtime error 1004
Application-defined error or object-defined error
Thank you in Advance
-C
Theres a problem which i do not know how to fix. I've got most of the program i made working but i just cant get the VLOOKUP to work.
The program shall be used on multiple OS platforms (Win Vista, Win 7, Mac OS X 10). The excel version is 2007.
Anyway heres the code:
Code:
Private Sub InsertData_Click()
Dim lRow As Long
Dim fRow As Long
Dim ws As Worksheet
Set ws = Sheet1
lRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
fRow = Range("A65536").End(xlUp).Row + 1
ws.Cells(lRow, "A") = Me.BillNrBox.Value
ws.Cells(lRow, "B") = Me.SenderBox.Value
ws.Cells(lRow, "C") = Me.ReceiverBox.Value
ws.Cells(lRow, "D") = Me.KgBox.Value * 1
ws.Cells(lRow, "E") = Me.M3Box.Value * 333
ws.Cells(lRow, "F") = Me.LVBox.Value * 1850
ws.Cells(fRow, "G").Formula = "=MAX(D" & fRow & ":F" & fRow & ")"
[COLOR="Red"]ws.Cells(fRow, "H").Formula = "=VLOOKUP(G" & fRow & ";Prices!$A$2:$B$56;TRUE)"[/COLOR]
BillNrBox.Value = vbNullString
SenderBox.Value = vbNullString
ReceiverBox.Value = vbNullString
KgBox.Value = "0"
M3Box.Value = "0"
LVBox.Value = "0"
HelpBox.Caption = "Info added to Worksheet"
End Sub
PS: Runtime error 1004
Application-defined error or object-defined error
Thank you in Advance
-C