View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Deleting Columns Based upon Heading

Hi Jessica,

Assume your headers are in row 1, try:
:
'=============
Public Sub Tester()
Dim Rng As Range

Set Rng = Rows(1).Find(What:="Bidder", _
After:=Range("A1"), _
MatchCase:=False)

If Not Rng Is Nothing Then Rng.EntireColumn.Delete

End Sub
'<<=============

Change Rows(1) to accord with the header row.

---
Regards,
Norman



"Jessica" wrote in message
...
I am writing a macro where I need to delete certain columns. I can write
the
code to delete columns by the letter (i.e., if I want to delete column C).
However I want to delete a column based upon the heading.

For instance, I want to delete the column entitled "Bidder". I can write
a
macro to find the header "Bidder", but I am not sure how to indicate that
I
want the column that the active cell is in to be deleted.