webwohnraum
webwohnraum

Reputation: 31

Is there a smarter Way to address several Columns

I want to extract Data in a table. I use the TextToColumns feature. I Know it is 4 entries long. I might have data to the right. (Depending on who is doing the data excerpt). I want to insert the 4 Columns

I now have 4 lines of inserting a new column.

.Columns(searchCol + 1).Insert Shift:=xlToRight
.Columns(searchCol + 1).Insert Shift:=xlToRight
.Columns(searchCol + 1).Insert Shift:=xlToRight
.Columns(searchCol + 1).Insert Shift:=xlToRight

Is there a smarter more elegant way to do that? (My code is running and working it is just about finesse)

Upvotes: 1

Views: 39

Answers (1)

Pᴇʜ
Pᴇʜ

Reputation: 57683

To insert 4 columns at once left of column searchCol + 1:

.Columns(searchCol + 1).Resize(ColumnSize:=4).Insert Shift:=xlToRight

Upvotes: 3

Related Questions