Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Remove Columns with header in row 1 but no data in remainder of co

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Remove Columns with header in row 1 but no data in remainder ofco

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to print one header over several columns of data column title print Excel Discussion (Misc queries) 1 May 28th 10 01:30 AM
How do I remove the header from only one page? Kathy Setting up and Configuration of Excel 1 June 30th 06 05:54 PM
How can I remove a header in a Spreadsheet Joe from Boca Excel Discussion (Misc queries) 1 January 23rd 06 08:58 PM
ALLOW ROW 1 AS HEADER ROW... NOT PART OF DATA SORT OF ANY COLUMNS. bro. Billy New Users to Excel 4 December 11th 04 12:01 AM
Remove Email address header Mark Excel Discussion (Misc queries) 2 December 3rd 04 10:27 PM


All times are GMT +1. The time now is 09:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"