1

这是一个简单的问题。我有这个代码:

 CurrentRow = 3
 MyColumn = 2
 CurrentCell = (CurrentRow & "," & MyColumn)
 WorkingSheet.Cells(CurrentCell).value = (ClientName & " " & "(" & ClientLocation & ")" & " " & ExtraDefinition)

我认为这会将“WorkingSheet”上的数据放在“B3”位置,但它会将数据放在“AF1”单元格中。

为什么是这样?

谢谢,

乔什

4

1 回答 1

2

Cell is not expected to be used as you are using it; you have to input the row and column indices (as integers) separated by a comma. Thus the right code is:

WorkingSheet.Cells(CurrentRow, MyColumn).Value = (ClientName & " " & "(" & ClientLocation & ")" & " " & ExtraDefinition)

Another alternative you have is using Range. Example:

WorkingSheet.Range("B3").Value = (ClientName & " " & "(" & ClientLocation & ")" & " " & ExtraDefinition)
于 2013-07-25T09:55:14.233 回答