Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / May 2008

Tip: Looking for answers? Try searching our database.

Remove Columns with header in row 1 but no data in remainder of co

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
BriLar1 - 23 May 2008 20:27 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.