locate cell with specific text and select that column

R

rockytopfan4ever

I need a macro that will search for a cell with specific text within a row
and then select its appropriate column. Any ideas?
 
N

Nayab

I need a macro that will search for a cell with specific text within a row
and then select its appropriate column.  Any ideas?

There are lot of ideas. First one is: why can't you put some serious
stuff and do it yourself? U just need to record the steps and then
play with the code in the macro as per your needs!!
 
D

Don Guillett

The macro recorder can be your friend. Recorded and cleaned up.

Sub Macro2()
'
' Macro2 Macro
' Macro recorded 7/30/2008 by Donald B. Guillett
'

'
Rows("1:1").Select
Selection.Find(What:="c", After:=ActiveCell, LookIn:=xlFormulas, LookAt
_
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate
End Sub

Sub findandselect()
Rows(1).Find("c", After:=Cells(1, 1), _
LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext).Activate
End Sub
 
G

Gary''s Student

First click on a cell in the row you want searched and then run:

Sub get_col()
s = "happiness"
n = ActiveCell.Row
For i = 1 To Columns.Count
If Cells(n, i).Value = s Then
Cells(n, i).EntireColumn.Select
End If
Next
End Sub

to find happiness.
 
Top