我想在"A1"中插入一些文本"ABC",并在"B1"中插入以下单元格if.但是我只插入第一个条目"ABC",然后输入错误FormulaR1C2 "Object doesn't support this property or method".我不确定我R1C2是否正确使用.我假设它代表第1行第2列,有人可以帮助我.
Dim Excel_App As Object
Dim strExcel As String
Set Excel_App = CreateObject("Excel.Application")
Excel_App.Visible = True
Excel_App.Workbooks.Add
With Excel_App
.Range("A:B").EntireRow.ColumnWidth = 25
.Range("A2").EntireRow.Font.FontStyle = "Bold"
.ActiveCell.FormulaR1C1 = "ABC"
strExcel = "=IF(A1 = """"," & """EMPTY""" & "," & """FILLED""" & ") "
.ActiveCell.FormulaR1C2 = strExcel
End With
Run Code Online (Sandbox Code Playgroud)