![]() |
Auto Delete Columns in a Macro that are Blank
Hello! I have a very large spreadsheet that I have created a Macro to format
and formulate. I can't seem to find the correct coding to put into the macro to search each and every column and get it to auto delete the column if it is blank (contains no data). Can someone help me with this? |
Auto Delete Columns in a Macro that are Blank
Option Explicit
Sub Testme() dim iCol as long dim Wks as worksheet set wks = worksheets("somenamehere") with wks for icol = .usedrange.columns(.usedrange.columns.count).colum n _ to 1 step -1 if application.counta(.columns(icol)) 0 then 'there's something in that column, skip it else .columns(icol).delete end if next icol end with end sub dkeglor wrote: Hello! I have a very large spreadsheet that I have created a Macro to format and formulate. I can't seem to find the correct coding to put into the macro to search each and every column and get it to auto delete the column if it is blank (contains no data). Can someone help me with this? -- Dave Peterson |
All times are GMT +1. The time now is 01:38 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com