【发布时间】:2012-10-29 23:05:10
【问题描述】:
我想在“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
【问题讨论】:
-
您愿意设置 NamedRange/Table 吗?将信息从 Access 转置到 NamedRange/Table 会容易得多,这样如果 Range 位置移动,您就不必进入输出逻辑并更改所有 Row/Col 位置