Can you delete a column based on a cell value?

iwilli

New Member
Joined
Jan 31, 2012
Messages
43
I have a report I download weekly from the corp. site. It contains sales stats for the previous week. I spend a lot of time rearranging the data so I can prepare weekly presentation for several managers. I built macros that deleted the column I don't need and that really sped things up. But know for some reason corporate keeps changing the format and my macros are deleting the wrong columns. Is there VBA code that will search for specific text in the first row of each column and delete the column if it doesn't match?

Cross Post: Excel Forum
 
Last edited:
Yes, I understand that this thread is 5 years old, but I didn't want to start another thread on the same topic.

Background: My company uses a cloud based company to track employee hours. Every month I run a report from said site and download it as an Excel worksheet. Unfortunately, there are several columns that I don't need as I am after only the actual hours worked and the report includes vacation hours, FMLA hours, etc. so I need to delete those I don't need. I would just record a macro, but the columns are dynamic and can vary month to month. Hence, the VBA route.

Now my issue: I am having a problem with the module/macro/sub-routine working with the downloaded sheet. It will delete all columns except column A. If I start with a fresh workbook and type the headers in, everything is sweet. Can someone explain to me what the blazes is going wrong????

Thanks,
Safety Guy
 
Upvote 0

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Forum statistics

Threads
1,223,243
Messages
6,170,971
Members
452,371
Latest member
Frana

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