can't get scroll macro to work

still learning

Well-known Member
Joined
Jan 15, 2010
Messages
826
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

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
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,224,737
Messages
6,180,653
Members
452,992
Latest member
TokugawaIesuma

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