Help in selecting range of header cells excluding cell 1 and cell 2 of the table vba

seragrefaat

Board Regular
Joined
Nov 16, 2020
Messages
53
Office Version
  1. 365
Platform
  1. Windows
I want to select the header row except headers of column 1 and column 2 from a Table.
I know this is used to select the entire header row:

VBA Code:
ActiveSheet.ListObjects("Table1").HeaderRowRange.Select

how to modify it to do what i want.
thanks
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
56,915
Office Version
  1. 365
Platform
  1. Windows
Hi & welcome to MrExcel.
How about
VBA Code:
   With ActiveSheet.ListObjects("Table1").HeaderRowRange
      .Offset(, 2).Resize(, .Columns.Count - 2).Select
   End With
 
Solution

smozgur

BatCoder
Joined
Feb 28, 2002
Messages
1,416
Welcome to the MrExcel Message Board!

The following is one of the methods to do what you need.
VBA Code:
With ActiveSheet.ListObjects("Table1").HeaderRowRange
    .Offset(, 2).Resize(, .Count - 2).Select
End With
 

seragrefaat

Board Regular
Joined
Nov 16, 2020
Messages
53
Office Version
  1. 365
Platform
  1. Windows
Hi & welcome to MrExcel.
How about
VBA Code:
   With ActiveSheet.ListObjects("Table1").HeaderRowRange
      .Offset(, 2).Resize(, .Columns.Count - 2).Select
   End With
Wow, thanks a lot
 

seragrefaat

Board Regular
Joined
Nov 16, 2020
Messages
53
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

Welcome to the MrExcel Message Board!

The following is one of the methods to do what you need.
VBA Code:
With ActiveSheet.ListObjects("Table1").HeaderRowRange
    .Offset(, 2).Resize(, .Count - 2).Select
End With
Amazing, thanks
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
56,915
Office Version
  1. 365
Platform
  1. Windows
Glad we could help & thanks for the feedback.
 

smozgur

BatCoder
Joined
Feb 28, 2002
Messages
1,416
@seragrefaat: That would be great if you could mark Fluff's post as the answer by clicking on the check mark right next to it. I'd like to remind this since you are a new member, and you might not know about it. This way, your question will be listed as a solved one in the thread list to help the future readers.

Thank you.
 

seragrefaat

Board Regular
Joined
Nov 16, 2020
Messages
53
Office Version
  1. 365
Platform
  1. Windows
@seragrefaat: That would be great if you could mark Fluff's post as the answer by clicking on the check mark right next to it. I'd like to remind this since you are a new member, and you might not know about it. This way, your question will be listed as a solved one in the thread list to help the future readers.

Thank you.
@seragrefaat: That would be great if you could mark Fluff's post as the answer by clicking on the check mark right next to it. I'd like to remind this since you are a new member, and you might not know about it. This way, your question will be listed as a solved one in the thread list to help the future readers.

Thank you.
Done, good to know.
 

Watch MrExcel Video

Forum statistics

Threads
1,130,220
Messages
5,640,960
Members
417,183
Latest member
CuteLeo

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
Top