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

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
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,215,693
Messages
6,126,246
Members
449,304
Latest member
hagia_sofia

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