selection of cell at the intersection of column B and the row ofwhatever cell is active

A

A & S

Hi

I have been messing around for several hours to try and figure out how
to do this but can never get quite what I want. I need to be able to
run the macro and have it select a cell by using the row of the
current active cell and column B. say for instance cell D5 is active,
I would want the macro to select cell B5, if F15 were active then I
would want it to select B15.

Any help would be appreciated.

Thank
 
L

Lars-Åke Aspelin

Hi

I have been messing around for several hours to try and figure out how
to do this but can never get quite what I want. I need to be able to
run the macro and have it select a cell by using the row of the
current active cell and column B. say for instance cell D5 is active,
I would want the macro to select cell B5, if F15 were active then I
would want it to select B15.

Any help would be appreciated.

Thank

Try this macro

Sub select_B()
ActiveSheet.Cells(ActiveCell.Row, "B").Select
End Sub

Hope this helps / Lars-Åke
 
A

A & S

Try this macro

Sub select_B()
   ActiveSheet.Cells(ActiveCell.Row, "B").Select
End Sub

Hope this helps / Lars-Åke

thanks that worked just like I wanted, I knew it had to be something
fairly simple
 
R

Rick Rothstein

Just so you can see there are usually more than one way to accomplish a goal
with code, here is another approach...

Sub SelectColumnB()
Intersect(Columns("B"), ActiveCell.EntireRow).Select
End Sub

--
Rick (MVP - Excel)


Try this macro

Sub select_B()
ActiveSheet.Cells(ActiveCell.Row, "B").Select
End Sub

Hope this helps / Lars-Åke

thanks that worked just like I wanted, I knew it had to be something
fairly simple
 
A

A & S

Try this macro

Sub select_B()
   ActiveSheet.Cells(ActiveCell.Row, "B").Select
End Sub

Hope this helps / Lars-Åke

I am now wondering, I highlighted the entire column B and typed
Description into the name box is there a way that I can use that title
instead of B

thanks
 
A

A & S

Just so you can see there are usually more than one way to accomplish a goal
with code, here is another approach...

Sub SelectColumnB()
  Intersect(Columns("B"), ActiveCell.EntireRow).Select
End Sub

--
Rick (MVP - Excel)






thanks that worked just like I wanted, I knew it had to be something
fairly simple- Hide quoted text -

- Show quoted text -

I am now wondering, I highlighted the entire column B and typed
Description into the name box is there a way that I can use that
title
instead of B

thanks
 
L

Lars-Åke Aspelin

I am now wondering, I highlighted the entire column B and typed
Description into the name box is there a way that I can use that title
instead of B

thanks


Yes, try this macro

Sub select_description()
ActiveSheet.Cells(ActiveCell.Row,
Range("Description").Column).Select
End Sub

Hope this helps / Lars-Åke
 
R

Rick Rothstein

Try this...

Sub SelectColumnB()
Intersect(Range("Description"), ActiveCell.EntireRow).Select
End Sub

--
Rick (MVP - Excel)


Just so you can see there are usually more than one way to accomplish a
goal
with code, here is another approach...

Sub SelectColumnB()
Intersect(Columns("B"), ActiveCell.EntireRow).Select
End Sub

--
Rick (MVP - Excel)

message




thanks that worked just like I wanted, I knew it had to be something
fairly simple- Hide quoted text -

- Show quoted text -

I am now wondering, I highlighted the entire column B and typed
Description into the name box is there a way that I can use that
title
instead of B

thanks
 
L

Lori

You can also just type into the name box one of these:
"c2 r" or "Description r" or "index(description,row())"

The equivalent in VBA is: application.goto "Description r" , etc.
An advantage is that you can use the macro recorder to generate the code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top