aab
aab

Reputation: 1739

Excel VBA select multiple columns

I'm trying to select multiple columns, i.e. Column A to Column F and Column H using the following formula:

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:

Runtime error 424, Object required`.

What am I missing?

Upvotes: 0

Views: 2629

Answers (1)

GMalc
GMalc

Reputation: 2628

Try Union.

Dim lrow As Long
lrow = enodebdata.UsedRange.Rows.Count

    Union(enodebdata.Range("A2:F" & lrow), enodebdata.Range("H2:H" & lrow)).Select

Upvotes: 2

Related Questions