How do I Remove Columns with header in row 1 but no data in remainder of
column?
I am using exported template spreadsheets that provide the header row ready
for data import to the spreadsheet then using this to do bulk import to SQL
database, but need to remove the blank columns were there is no data below
the header en mass. Can anyone give me tips on how this could be done either
using vb code or macros.
Thanking you in advance
merjet - 23 May 2008 21:09 GMT
Change the numbers if Excel 2007.
Sub Macro1()
Dim iCol As Integer
Dim iRow As Long
For iCol = 256 To 1 Step -1
iRow = Cells(65536, iCol).End(xlUp).Row
If iRow = 1 Then Columns(iCol).Delete
Next iCol
End Sub
Hth,
Merjet