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

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

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
 

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!
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,322
Messages
5,769,452
Members
425,548
Latest member
macjagger17

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