Selecting cells in the active row

steve case

Well-known Member
Joined
Apr 10, 2002
Messages
823
Good morning all, here I am at the well again :oops:

I want to write VBA code to select the data in the active row.

If my data is in Range(A1:K999) and the active cell is G22 then I should like a macro to select Range(A22:K22) or if it's B9, Range(A9:K9) will be selected and so on.
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Hi S,

How about:
Code:
Sub Test()
    Dim l As Long
    l = ActiveCell.Row
    Range(Cells(l, "A"), Cells(l, "K")).Select
End Sub
HTH
 
Upvote 0
Beautiful!

:pray:

That was not in Chaper 11 of Walkenback's book!

And it only took ten minutes!
 
Upvote 0

Forum statistics

Threads
1,214,419
Messages
6,119,389
Members
448,891
Latest member
tpierce

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top