Reputation: 15
I'm getting an run-time error '1004' application-defined or object-defined error when I'm using the following vba code:
Private Sub CommandButton1_Click()
Dim formul as String
'Run Tercih14
formul = "=vlookup($c$15;'Şube Listesi'!$B:$J;9;FALSE)"
Sheet35.Range("F12").Formula = formul
End Sub
I can change the value of the F12 cell.assign
different formulas like =sum(A1:A2)
etc. If I create a new sheet and edit the code for the new sheet it works fine with the vlookup
formula.
I checked, the sheet is not protected . I'm having trouble figuring out what the problem is here. Hope you guys can help me find the solution.
Upvotes: 1
Views: 542
Reputation: 1
I had the same kind of issue with a formula containing variable
Dim Instruc As String
Instruc = "=MAX(R" & CStr(suiv) & ";S" & CStr(suiv) & " )"
MAIN.Cells(suiv, 20).Formula = CStr(Instruc)
When I use the ; caracter in the formula, I always get the run-time error '1004' application-defined or object-defined error I used a variant of the formula with the : caracter
Dim Instruc As String
Instruc = "=MAX(R" & CStr(suiv) & ";S" & CStr(suiv) & " )"
MAIN.Cells(suiv, 20).Formula = CStr(Instruc)
Upvotes: 0
Reputation: 1983
Change
"=vlookup($c$15;'Şube Listesi'!$B:$J;9;FALSE)"
to
"=vlookup($c$15,'Şube Listesi'!$B:$J,9,FALSE)"
You are using ;'s instead of ,'s
Upvotes: 3