这是一个简单的问题。我有这段代码:
CurrentRow = 3
MyColumn = 2
CurrentCell = (CurrentRow & "," & MyColumn)
WorkingSheet.Cells(CurrentCell).value = (ClientName & " " & "(" & ClientLocation & ")" & " " & ExtraDefinition)
我认为这会将'WorkingSheet'上的数据放在“B3”位置,但它会将数据放在单元格“AF1”中。
为什么会这样?
谢谢,
约什
答案 0 :(得分:2)
Cell
,因为您正在使用它;你必须输入用逗号分隔的行和列索引(作为整数)。因此,正确的代码是:
WorkingSheet.Cells(CurrentRow, MyColumn).Value = (ClientName & " " & "(" & ClientLocation & ")" & " " & ExtraDefinition)
另一种替代方法是使用Range
。例如:
WorkingSheet.Range("B3").Value = (ClientName & " " & "(" & ClientLocation & ")" & " " & ExtraDefinition)