PDA

View Full Version : [SOLVED:] This should be easy



gsouza
08-10-2005, 11:33 AM
No matter where I am in a worksheet, how do I select the cell in the same column all the way to the left (column "a") with VBA. I need it in my code but I cant seem to do it. I know it is easy I just have mental block right now.

Norie
08-10-2005, 12:36 PM
Try this.


Cells(ActiveCell.Row,"A").Select

gsouza
08-10-2005, 12:38 PM
Thank you so much.

Ken Puls
08-10-2005, 12:39 PM
Hi there,

This reads the currently selected row and selects the cell in column A:


Sub test()
Dim lRow As Long
lRow = Selection.Row
Range("A" & lRow).Select
End Sub

You'll probably have to modify it to suit your needs, but at least it will give you somewhere to start.

HTH,

EDIT: See that Norie beat me to it! LOL!

Bob Phillips
08-10-2005, 01:22 PM
Ken,

Problem if more than one row is selected. It returns top left cell row, regardless of what is active.

gsouza
08-10-2005, 01:25 PM
Thanks for everybody's help.

Ken Puls
08-10-2005, 01:35 PM
Ken,

Problem if more than one row is selected. It returns loft left cell row, regardless of what is active.

True enough, Bob. Figured it would probably be outside of the scope, but should have noted it. :yes

Cheers!