Thread: finding column
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.newusers
Roger Govier[_3_] Roger Govier[_3_] is offline
external usenet poster
 
Posts: 2,480
Default finding column

Hi

Try the following

Sub findDelete()
Dim c As String
Dim Rng As Range
c = InputBox("Enter string to delete.")
Set Rng = Nothing
Set Rng = Range("12:12").Find(what:=c, _
After:=Range("C12"), _
LookIn:=xlFormulas, _
lookat:=xlPart, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, _
MatchCase:=False)
Rng.EntireColumn.Delete shift:=xlLeft
End Sub

--
Regards
Roger Govier

"Squirrel-Salad" wrote in message
6.253...
Gooday all,

I currently have some names in various columns but on the same same row. I
have at the moment been able to search for a name in the column. But as I
dont know the actual cell how can I find the cell name?

example names are in D12, E12 .... P12 they are all on row 12 but I dont
know the column. the search looks at each column untill it finds a match,
if it gets to an empty cell on row 12 the search ends, if it find the cell
I need to delete the column. Taking into acount that P12 may go as far as
FF12!! I dont actualy know.

Does this make sense?