Get Macro to Scroll to Specific Row

DougRobertson

Active Member
Joined
Sep 22, 2009
Messages
334
Office Version
  1. 365
Platform
  1. Windows
Hello,

If:

Cell C1 = "Sunday",
Cell C2 = "Monday",
Cell C3 = "Tuesday",
Cell C4 = "Wednesday" etc;

and iDay = "Wednesday",

is there a way to have a macro scroll to where Row 4 would be at the top of my screen?

Thanks in advance,

~ Doug
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Try like this

Code:
Sub test3()
Const iDay As String = "Wednesday"
Dim Found As Range
Set Found = Columns("C").Find(what:=iDay, LookIn:=xlValues, lookat:=xlWhole)
If Not Found Is Nothing Then Application.Goto Found, True
End Sub
 
Upvote 0
Depending on how you're defining iDay, maybe something like:
Code:
Sub scrollme()
 
Dim iDay As String
Dim i As Long, j As Long
 
iDay = InputBox("Enter value you want to scroll to:")
 
i = Range("C" & Rows.Count).End(xlUp).row
 
On Error GoTo Notfound
 
j = Range("C1:C" & i).Find(what:=iDay, after:=Range("C1")).row
ActiveWindow.ScrollRow = j
Exit Sub
 
Notfound:
MsgBox "Your value is not found, macro exiting"
 
End Sub
 
Upvote 0
Hi guys,

I happy to report that both programs worked quite nicely. One for having the exact cell show up in the top left hand corner, and the other for just having the row brought to the top of the screen.

Nicely done! I appreciate you sharing your knowledge on things Excel.


~ Doug
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,749
Members
452,940
Latest member
rootytrip

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