Include header when selecting a column range

eblack93

New Member
Joined
Oct 1, 2021
Messages
19
Office Version
  1. 2019
Platform
  1. Windows
Hi,

I have the following code as I'm working on multiple selections:

With ActiveSheet.ListObjects("Main")
Union(.ListColumns(1).Range, _
.ListColumns(3).Range, _
.ListColumns(5).Range, _
.ListColumns(10).Range, _
.ListColumns(30).Range, _
.ListColumns(31).Range).Select

My problem is that only when I sort the table by one of the columns, the selection does not include the table headers for the corresponding columns listed above and only selects the content.

I want the selection to include the headers for those columns above but I have been unable to find a suitable solution online.

Thanks
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Forum statistics

Threads
1,214,983
Messages
6,122,595
Members
449,089
Latest member
Motoracer88

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