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 / New Users / March 2007

Tip: Looking for answers? Try searching our database.

Delete Column

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bernie - 28 Feb 2007 20:40 GMT
In Excel, I need a macro that will delete a column based on a cell
that will contain a name based on an input box.

Thanks,
Bernie
Gord Dibben - 28 Feb 2007 20:55 GMT
Bernie

Will the name be found only in one column or many columns?

If many, which one or more of the many would you like deleted?

Gord Dibben  MS Excel MVP

>In Excel, I need a macro that will delete a column based on a cell
>that will contain a name based on an input box.
>
>Thanks,
>Bernie
Bernie - 28 Feb 2007 21:34 GMT
> Bernie
>
[quoted text clipped - 11 lines]
>
> - Show quoted text -

The name will be found only in one column.  Thanks!
Gord Dibben - 28 Feb 2007 23:43 GMT
Try this with a fixed column.

Note the lines to make it a selectable column if you wanted.

Public Sub DeleteColOnWord()
Dim coltocheck As Range
Dim thename As String
On Error GoTo endit

   Set coltocheck = Range("D:D")
   '   Set coltocheck = Application.InputBox(Prompt:= _
   '         "Select A Column", Type:=8)
   thename = InputBox("enter a name")
   For Each i In coltocheck
       If i.Value = thename Then _
               i.EntireColumn.Delete
   Next i
   
endit:
End Sub

Gord

>> Bernie
>>
[quoted text clipped - 13 lines]
>
>The name will be found only in one column.  Thanks!
Bernie - 01 Mar 2007 14:00 GMT
> Try this with a fixed column.
>
[quoted text clipped - 38 lines]
>
> - Show quoted text -

Thank you so much, I modified it to fit my current workbook and it
worked perfectly.

Bernie
Gord Dibben - 01 Mar 2007 16:32 GMT
Thanks for the feedback.

Gord

>> Try this with a fixed column.
>>
[quoted text clipped - 43 lines]
>
>Bernie
Don Guillett - 28 Feb 2007 21:17 GMT
Have a look in the vba HELP index for FIND or FINDNEXT.
Signature

Don Guillett
SalesAid Software
dguillett1@austin.rr.com

> In Excel, I need a macro that will delete a column based on a cell
> that will contain a name based on an input box.
>
> Thanks,
> Bernie
 
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.