I'm trying to highlight a column starting from row 2 this is my code below
我正在尝试突出显示从第2行开始的列,这是我的代码
Dim Lastrow As Integer
Lastrow = Sheets("OPEN - REPEAT").Cells(Rows.Count, 1).End(xlUp).Row
Workbooks(var2).Sheets("OPEN - REPEAT").Columns("A2" & Lastrow).Interior.Color = vbYellow
I keep getting the following error Application or Object Defined error 1004 any idea what I might be doing wrong?
我一直得到以下错误应用程序或对象定义错误1004任何想法我可能做错了什么?
1 个解决方案
#1
3
.Columns("A2" & Lastrow)
is all wrong. Use .Range
and you also need to specify an end column and end row, so it should look like this:
.Columns(“A2”和Lastrow)都错了。使用.Range,您还需要指定结束列和结束行,因此它应如下所示:
Workbooks(var2).Sheets("OPEN - REPEAT").Range("A2:A" & Lastrow).Interior.Color = vbYellow
#1
3
.Columns("A2" & Lastrow)
is all wrong. Use .Range
and you also need to specify an end column and end row, so it should look like this:
.Columns(“A2”和Lastrow)都错了。使用.Range,您还需要指定结束列和结束行,因此它应如下所示:
Workbooks(var2).Sheets("OPEN - REPEAT").Range("A2:A" & Lastrow).Interior.Color = vbYellow