Macro to delete columns

  • Thread starter Thread starter Luong
  • Start date Start date
L

Luong

Hello,

I have a macro to import text file data into an Excel
spreadsheet. Sometimes, several columns imported have
blank data and can be random columns. I would like to
write a macro to do the followings:
1) From column A-M, If any column along row cell 9 is
blank, then delete the entire columns with blank data.

Thanks for any help.
 
Sub DeleteBlanks()
Range("A9:M9").SpecialCells(xlCellTypeBlanks).EntireColumn.Delete
End Sub
 
Back
Top