Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Write a formula into EXCEL

Status
Not open for further replies.

VojtaR

Automotive
Apr 2, 2020
20
0
0
CZ
Hello,

I am looking everywhere for a way how to write a formula into cell, but am keep getting this error:

---------------------------
CNEXT - CATScriptErrorMessages - ScriptingERR_1002
---------------------------
Execute the script "Excel formulas.CATScript".
The scripting engine for CATScript has reported the following error:

Source: Microsoft VBScript runtime error
Description: Unknown runtime error
Line: 13
Column: 0



Here is my code:
Code:
Sub CATMain()

Set Excel = CreateObject("Excel.Application")
Excel.visible = true

Set workbooks = Excel.Application.workbooks
Set myworkbook = Excel.workbooks.Add
Set objsheet1 = Excel.Sheets.Add


objsheet1.Cells(1, 1) = "Part Name"
objsheet1.Cells(1, 2) = "Localization"
objsheet1.Cells(2, 2) = "=LEFT($A2;2)"
   
End Sub

Can anyone help me with that?

Thanks
 
Replies continue below

Recommended for you

Status
Not open for further replies.
Back
Top