How do I select a row with vba?

Lil2606

Board Regular
Joined
Jan 29, 2019
Messages
79
Hi all,

I'm sitting in front of a deadline project and I seem to be forgetting the basics.. my own name will be the next one.. I'm getting compile errors and I can't figure out the correct syntax.

Code:
Sub try_this()


Sheet4.Activate


Dim headerrowin As Long


headerrowin = Sheet4.ListObjects("Table3").HeaderRowRange.Row


'Select the entire ("headerrowin-th" --> 85th) row I need to refer to it in the context of the sheet not the table.. so, something like Sheet4.ListObjects("Table3").HeaderRowRange.EntireRow.Select won't do.

Sheet4.Range(??????


End Sub
Could someone help please?
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
What is it you want to select exactly?
 
Upvote 0
Code:
[COLOR=#333333]Sheet4.ListObjects("Table3").HeaderRowRange.EntireRow.Select[/COLOR]

that just with a different syntax which doesn't include listobjects
 
Upvote 0
Not 100% sure what you want to select but this will select the entire row that the header row of 'Table3' on Sheet4 is on.
Code:
Dim headerrowin As Long
Dim rng As Range

    headerrowin = Sheet4.ListObjects("Table3").HeaderRowRange.Row

    Sheet4.Rows(headerrowin).Select
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,241
Members
452,622
Latest member
Laura_PinksBTHFT

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