Home>

I want to put the following formula in a cell with Excel VBA. (Tentatively process the 4th line)
"= IF (S4 = 0, L4-N4, ROUNDDOWN (O4 * ROUNDDOWN (K4,3), 0)"
The problem is described below, so if you have any questions, would you please teach me?

Run-time error '1004'
Application definition or object definition error.
Corresponding source code
With sheet object name
    .Cells (4, 16) .FormulaLocal = "= IF ("&.Cells (4, 19) .Address (False, False)&"= 0,"&.Cells (4, 12) .Address (False, False) )&"-"&.Cells (4, 14) .Address (False, False)&", ROUNDDOWN ("&.Cells (4, 15) .Address (False, False)&"* ROUNDDOWN ("&.Cells (4, 11) .Address (False, False)&", 3), 0)"
End With
What I tried

I tried the cell to be assigned with the following properties, but all of them gave the same error.

  • Formula
  • Value
  • Add no properties

I tried to enter "= IF (S4 = 0, L4-N4, ROUNDDOWN (O4 * ROUNDDOWN (K4,3), 0)" directly as a character string, but the same error occurred.

Supplementary information (FW/tool version, etc.)

Please provide more detailed information here.