[英]Excel VBA select multiple columns
I'm trying to select multiple columns, ie Column A
to Column F
and Column H
using the following formula:我正在尝试使用以下公式 select 多列,即
A
列到F
列和H
列:
enodebdata.Range(enodebdata.Range("A2:F2, H2"), enodebdata.Range("A2:F2, H2").End(xlDown).Range("F2")).Select
The problem is it only selects Columns A
to F
and gives the following error:问题是它只选择
A
到F
列并给出以下错误:
Runtime error 424, Object required`.
运行时错误 424,需要 Object`。
What am I missing?我错过了什么?
Try Union
.试试
Union
。
Dim lrow As Long
lrow = enodebdata.UsedRange.Rows.Count
Union(enodebdata.Range("A2:F" & lrow), enodebdata.Range("H2:H" & lrow)).Select
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.