VBA code string to cell not working – run time error 1004

I’m trying to accomplish something very simple. Actually it used to run normally but when I changed to windows 7 + Office 2013 it just stopped working.

The following line in VBA won’t work:

  • extract number from string excel
  • Using string array as criteria in VBA autofilter
  • Dividing column intro groups that contains time values
  • Excel VBA - don't error out if criteria isn't found
  • Why do I failed to read Excel 2007 using POI?
  • Excel 2010 - One Combobox selection limits the second Combobox results
  • Worksheets("Charts").Cells(2, 7) = "=" & "23,45" & "/PL!C" & 2

    Charts is an existent sheet of mine and PL is another existent sheet.

    If I add watch to the right hand side equation I get the following formula, which when pasted to the cell (manually) does work.


    The error I’m getting is:

    Run-time error '1004':
    Application-defined or object-defined error

    I’ve looked into several run time error 1004 questions but none of them seem to either be the same issue or work for me. Any ideas ? thanks

  • C# console app that does Excel Interop - failing when running as scheduled Task -System.UnauthorizedAccessException
  • Object required error when trying to get End(xlDown) + 1 row
  • Excel lookup from a list of times
  • find last match in column using built in functions in excel vba
  • Excel. Use information from two different sources
  • Scripting Language that can count number of files and do simple plotting
  • One Solution collect form web for “VBA code string to cell not working – run time error 1004”

    Use the Range.Formula property with EN-US syntax or Range.FormulaLocal property with your regional locale settings.

    Worksheets("Charts").Cells(2, 7).FORMULA = "=" & "23.45" & "/PL!C" & 2
    Worksheets("Charts").Cells(2, 7).FORMULALOCAL = "=" & "23,45" & "/PL!C" & 2

    VBA is very EN-US-centric as providing translation for all regional settings ‘on-the-fly’ would create a large overhead.

    MS Excel Spreadsheet is the best Office Software, Excel VBA and Excel Formulas make Spreadsheet work faster.