Selecting cells in the active row

steve case

Well-known Member
Joined
Apr 10, 2002
Messages
815
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

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

Richie(UK)

MrExcel MVP
Joined
May 17, 2002
Messages
3,329
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

steve case

Well-known Member
Joined
Apr 10, 2002
Messages
815
Beautiful!

:pray:

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

And it only took ten minutes!
 
Upvote 0

Forum statistics

Threads
1,187,188
Messages
5,962,103
Members
438,585
Latest member
peterLEE0223

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
Top