Selecting multiple columns (not adjacent to each other) in a table using column names

excelguru123

New Member
Joined
Jun 23, 2021
Messages
6
Office Version
  1. 2013
Platform
  1. Windows
Hi all, I have a table with multiple columns and I am trying to select multiple columns using their names. Columns aren't necessarily adjacent to each other so I want to use column names to select them. Here is a code:

With wbMyWorkbook.Sheets("Sheet1").ListObjects("Table1")
.ListColumns("Name").Range.Select
.ListColumns("Address").Range.Select
.ListColumns("City").Range.Select
End With

Using this works but it doesn't select ALL of the columns "Name", "Address", & "City". Instead, it will select one column at a time. This is just 3 columns as an example but I have around 15 columns I want selected. To make it cleaner I tried to use an array in .ListColumns() but it takes a single object only. How can I make this work? Thanks in advance.
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Hi @excelguru123

see @Akuini's answer in this thread

 
Upvote 1
Hi @excelguru123

see @Akuini's answer in this thread

Thanks a lot. That's exactly what I was looking for.
 
Upvote 0

Forum statistics

Threads
1,223,632
Messages
6,173,472
Members
452,516
Latest member
archcalx

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top