我正在尝试将值放入单元格中。我使用行和列的变量来引用单元格。
我尝试过:
Dim rowCounter As Long, columnCounter As Long
rowCounter = 18
columnCounter = 10
Range(Columns(columnCounter) & rowCounter).Value = "Did this work?"
我收到类型不匹配错误。
答案 0 :(得分:1)
使用Range对象的Cells property,而不是Range object。对于J18:
Dim rowCounter As Long, columnCounter As Long
rowCounter = 18
columnCounter = 10
with worksheets(1)
.Cells(rowCounter, columnCounter).Value = "Did this work?"
end with
您应该真正开始提供正确的父级工作表引用的实践。