find and go to cell with same value in another column

marcs

Active Member
Joined
May 3, 2005
Messages
420
how does a macro look for this?

I'm in column A and select a cell with the value 'xyz' I want to now search column B for a cell with the same value and select it.

all help appreciated
 

Some videos you may like

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

dgpenny

New Member
Joined
Jan 1, 2004
Messages
46
Is column B that long to where you cannot easily search for yourself? Maybe some more info would be helpful. Thanks.
 

dgpenny

New Member
Joined
Jan 1, 2004
Messages
46
This works for me.

Private Sub CommandButton1_Click()
'
' Findin_B Macro
'
'

Dim xyz As String

ActiveCell.Select
xyz = ActiveCell.Value

Cells.Find(What:=xyz, After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
End Sub
 

marcs

Active Member
Joined
May 3, 2005
Messages
420
thanks dgpenny. I wasn't quite clear in my question.

It should really have read -

I'm in column A and select any cell. Let's say it has the value 'xyz'. I want to now search column B for a cell with the same value and select it. (As it happens there will always be a cell with the same value in column B.)
 

marcs

Active Member
Joined
May 3, 2005
Messages
420
It does indeed! I had made a mistake when I copied it and thought it wasn't working.

Many thanks.

Heimir
 

Watch MrExcel Video

Forum statistics

Threads
1,118,799
Messages
5,574,388
Members
412,590
Latest member
Velly
Top