AutoScroll/Smallscroll problem VBA

JWebb

New Member
Joined
Apr 5, 2017
Messages
17
Working on PC using excel 2016.

I have a userform macro that once filled out takes to user to the applicable worksheet and selects the applicable row. What I can't seem to get fixed is autoscrolling that work sheet to the active row. The active row location is always unknown (could be the first row or the last).

My code is:
Code:
ActiveSheet.Range("C:C").Find(Sheets("shhet2").Range("D1"), Lookin:=xlValues, LookAt:=xlWhole, Ma
tchCase:=True).EntireRow.Select
'the above works just fine
"the below doesn't
Activewindow.Scrollrow = ComboBox3.value

I get a 'type mismatch' error.

When I hover in the debugger, ComboxBox3 value is correct but when I hover over the scrollrow it is incorrect even the the correct row is selected (highlighted as active).

Thanks in advance!
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
So I tried another angle:

Code:
Activewindow.SmallScroll Down:=ActiveSheet.Range("C" & Activecell.Row).Value, Up:ActiveSheet.Range("C" & Activecell.Row).Value

I did down and up just in case it would ever need to scroll up based on the users next selection.
I get a "smallScroll method of Window class failed" error.

My whole goal here is to make the activerow visible to the user so they don't have to scroll to find it as there could be 400ish rows on a given sheet. Doesn't matter to me how I get there.

Any help is much appreciated.
 
Upvote 0
Nevermind, I'm an idiot :)

Code:
ActiveWindow.ScrollRow = Selection.Row

puts it right at the top everytime - just like the code tells it to.
I knew it was simpler than I was making it.

Thanks to all who have read this post.
 
Upvote 0

Forum statistics

Threads
1,215,517
Messages
6,125,288
Members
449,218
Latest member
Excel Master

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