Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default How to delete columns with headings but rows are empty

Hi,
I have data where columns have headings but rows are blank. I have
approx 500 rows of data.

ID Student Course 1 Course 2
2 Tom 0
3 Suzie

Thanks for your assistance
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default How to delete columns with headings but rows are empty


--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Deb" wrote:

Hi,
I have data where columns have headings but rows are blank. I have
approx 500 rows of data.

ID Student Course 1 Course 2
2 Tom 0
3 Suzie

Thanks for your assistance
.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default How to delete columns with headings but rows are empty

Deb,

If I understand correctly we loop through columns and if there are no data
in the column except for the header row we delete the entire column. If
that's correct then try this macro

Sub Del_Cols()
Dim Col As Long
Set sht = Sheets("Sheet1")
For Col = sht.UsedRange.Columns.Count To 1 Step -1
If sht.Cells(Rows.Count, Col).End(xlUp).Row = 1 Then
Columns(Col).EntireColumn.Delete
End If
Next
End Sub
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Deb" wrote:

Hi,
I have data where columns have headings but rows are blank. I have
approx 500 rows of data.

ID Student Course 1 Course 2
2 Tom 0
3 Suzie

Thanks for your assistance
.

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
Hpw do I delete multiple empty rows found between filled rows? Bill Excel Worksheet Functions 2 November 15th 09 07:12 PM
Cut filtered rows, paste into next empty row of new sheet, and delete cut rows Scott Excel Worksheet Functions 0 December 13th 06 01:25 AM
Delete rows that are empty across columns ALATL Excel Worksheet Functions 0 November 6th 06 04:09 AM
Delete rows with empty cells in columns B&C Richard Excel Discussion (Misc queries) 3 March 18th 06 12:15 AM
how do i delete the extra empty rows and columns that i dont need. lindaY Excel Discussion (Misc queries) 3 March 20th 05 03:48 PM


All times are GMT +1. The time now is 01:02 PM.

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"