can't get scroll macro to work

still learning

Well-known Member
Joined
Jan 15, 2010
Messages
821
Office Version
  1. 365
Platform
  1. Windows
Hi

VBA Code:
Private Sub Worksheet_activate()
Application.Goto Reference:=Range(Format(Date, "mmmm")), Scroll:=True
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveWindow.FreezePanes = True
Dim C As Range
Set C = Range("H1:H450").Find(Date)
If Not C Is Nothing Then C.Select
If ActiceCell.Row < 12 Then ActiveWindow.ScrollRow = ActiveCell.Row – 12
End Sub
When the spreadsheet opens
The macro finds the current month in the column (H1:H450) and scrolls it to the top, then freezes the row. It then goes to the current date in the same column
Since I only have 28 rows in view, sometimes the last few days are out of view…I want to keep the screen at 100% zoom
I’m trying to have that cell scroll up if its out of view.
I’m trying to have that cell scroll up to the title (frozen row) and drop down a few
I don’t need it to do it every time, only when the cell that is found is out of view
The macro worked perfect till I added the “ActiceCell.Row > 12 Then ActiveWindow.ScrollRow = ActiveCell.Row – 12” …(I picked 12 as a test case till I get the macro to work)
Then I get an error “object required”
I though the “object” would be the cell with the current day


mike
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Try:
VBA Code:
Private Sub Worksheet_activate()
    Application.Goto Reference:=Range(Format(Date, "mmmm")), Scroll:=True
    ActiveCell.Offset(1, 0).Range("A1").Select
    ActiveWindow.FreezePanes = True
    Dim C As Range
    Set C = Range("H1:H450").Find(Date)
    If Not C Is Nothing Then
        C.Select
        Application.Goto ActiveCell.EntireRow, True
    End If
End Sub
 
Upvote 0
Solution
Hi mumps
hope your having a good weekend
first I got an error message at End If. I deleted it
I then use your macro and it worked like i wanted
Thank you

mike
 
Upvote 0

Forum statistics

Threads
1,223,703
Messages
6,173,973
Members
452,540
Latest member
haasro02

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