wgilthorpe
New Member
- Joined
- Dec 6, 2014
- Messages
- 7
I am writing a tool to create quotations at work. Not really in the scope of my job, but it needs to get done. I am having trouble with the below loop. I cannot for the life of me (after much trial and error and the failure of my Google Fu) figure out how to get the below to work. I keep getting runtime error 1004. However, in one of my trials I found that if the first equal sign inside quotes is left out, then the text is inserted into the cells correctly. It is very frustrating. All help will be appreciated.
For i = 13 To 346
If spirSheet.Cells(i, 2).Interior.Color <> 12566463 Then spirSheet.Cells(i, 2).Formula = "=iferror(" & "vlookup(e" & i & ";" & "'" & sheetname & "'" & "!$C$15:$E$1000;3;FALSE)" & "/" & "vlookup(e" & i & ";" & "'" & sheetname & "'" & "!$C$15:$E$1000;2;FALSE));0)"
Next i
The below is the formula that I am trying to insert (included for clarity). Below sheetname = "01-FT-014xxx"
=IFERROR(VLOOKUP(E13;'01-FT-014xxx'!$C$15:$E$1000;3;FALSE)/(VLOOKUP(E13;'01-FT-014xxx'!$C$15:$E$1000;2;FALSE));0)
For i = 13 To 346
If spirSheet.Cells(i, 2).Interior.Color <> 12566463 Then spirSheet.Cells(i, 2).Formula = "=iferror(" & "vlookup(e" & i & ";" & "'" & sheetname & "'" & "!$C$15:$E$1000;3;FALSE)" & "/" & "vlookup(e" & i & ";" & "'" & sheetname & "'" & "!$C$15:$E$1000;2;FALSE));0)"
Next i
The below is the formula that I am trying to insert (included for clarity). Below sheetname = "01-FT-014xxx"
=IFERROR(VLOOKUP(E13;'01-FT-014xxx'!$C$15:$E$1000;3;FALSE)/(VLOOKUP(E13;'01-FT-014xxx'!$C$15:$E$1000;2;FALSE));0)