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