我希望使用变量来查找范围,然后使用它们来激活选择。
这是我的代码:
Dim first As Integer
Dim Last As Integer
first = (ActiveCell.Row + 1)
Selection.End(xlDown).Select
Last = (ActiveCell.Row - 1)
Range(("J" & first) : ("J" & last)).Select
但是,我在Excel VBA 2010中收到了语法错误。
任何建议。
谢谢,
答案 0 :(得分:1)
Range语法是Range(“A1:B2”),因此您需要将代码修改为:
Dim first As Integer
Dim Last As Integer
first = (ActiveCell.Row + 1)
Selection.End(xlDown).Select
Last = (ActiveCell.Row - 1)
Range("J" & first & ":" & "J" & Last).Select