我试图通过使用范围函数使用vba在excel中选择一个单元格.
在使用变量指定范围而不仅仅是数字之前,我已经做了很多次.
但是,我似乎无法使用单元格函数选择范围.
我知道这是可能的,因为我做了很多研究,并且已经看到其他人的代码将成功运行使用此功能.
下面是我用来尝试选择范围(只有1个单元格)的语法.
此外,当我运行代码时,我收到以下消息:
"运行时错误'1004':对象'_Global'的'范围'方法失败".
感谢您的帮助.
Dim item As String
Dim itempaste As Boolean
Dim itemcnt As Integer
itemcnt = 1
itempaste = False
Range("X3").Select
Do
item = ActiveCell.Value
If item <> "" Then
Range("A18").Select
Do
If ActiveCell.Value = "" Then
ActiveCell.Value = item
itempaste = True
Else
ActiveCell.Offset(1, 0).Select
End If
Loop Until itempaste = True
End If
itemcnt = itemcnt + 2
Range(Cells(1, (21 + itemcnt))).Select
Loop Until itemcnt = 11
Run Code Online (Sandbox Code Playgroud)