Delete non-empty columns

Rainmanne

Board Regular
Joined
Mar 10, 2016
Messages
132
Office Version
  1. 2013
Platform
  1. Windows
I have a table with columns of data, the number of which may vary. I need to write a simple code to include in a macro, which would delete all non-empty columns after column G. All the columns have headers in row 1. I am just a bit confused with a number of options.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Is this a "real" Excel table object or just an area of the worksheet that you think of as a table?
 
Upvote 0
Is this a "real" Excel table object or just an area of the worksheet that you think of as a table?
Yes, it's a spreadsheet in Excel. I've got a model which imports data from another spreadsheet and then uses preset tables with formulas to organise it differently. Depending on a number of years of data, it's fill the formulae right. When I need to update the formulae for any reason, I'm doing it in the resulted file and then comment out the formulas and delete all the years but the first one. I used to do it manually. I've got a macro to comment out formulas (there are a lot of them) but some other things I did manually. So I want to automate it as well.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,327
Members
452,635
Latest member
laura12345

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