selecteer eerste zichtbare rij bovenaan na scrollen

littlepete

Well-known Member
Joined
Mar 26, 2015
Messages
503
Office Version
  1. 365
Platform
  1. Windows
hallo allemaal :)

eerst nog maar eens als beginneling mijn dank uiten naar iedereen die tot nu al geholpen heeft :) !!!

er blijft toch één bizar feitje over :
mijn adressenlijst toont de gefilterde lijst van geboortes, huwelijk, overlijdens, gebeurtenissen, scheidingen en hertrouwen van de lopende maand,
netjes chronologisch met bovenaan als eerst zichtbare het eerstvolgende event vanaf vandaag... allemaal perfect :) !
maar: als ik kijk naar de celverwijzing toont deze niét de eerst zichtbare, maar een verborgen cel helemaal bovenaan...

mijn (lange) macro doet eerst het aflopen van alle data;
daarna sorteert hij alles;
daarna scrollt hij naar de eerstvolgende event: dit is de vba :
VBA Code:
Sub scrolltoday()
    Dim rng As Range
    Dim c As Range
    Dim firstrow As Long
    Dim lastrow As Long
    Dim foundrow As Long
    Dim searchdate As String
    firstrow = 5 'startrow for search - first cell under title
    searchdate = Format(Date, "mmdd") & "0"
    lastrow = Range("cd" & Rows.Count).End(xlUp).Row
    Set rng = Range("cd" & firstrow & ":cd" & lastrow)
    foundrow = 0
    For Each c In rng
        If c.Value > searchdate And foundrow = 0 Then foundrow = c.Row
    Next
    If foundrow > 0 Then ActiveWindow.ScrollRow = rng(foundrow + 1 - firstrow).Row
End Sub

daarna moet hij 'tooneerstecel' uitvoeren. maar doet dat niet.
als ik deze maneel selecteer in de macrolijst wordt die echter wél perfect uitgevoerd. de vba :
VBA Code:
einde:
Application.ScreenUpdating = True
If Keuze = 9 Then
    scrolltoday
    tooneerstecel
Else
    tooneersterij
End If

(de macro 'tooneersterij' moet werken als ik de maand zelf heb ingevuld en niet kies voor de lopende maand, die werkt goed)

de macro 'tooneerstecel' ziet er zo uit :
VBA Code:
Sub tooneerstecel() ' ----------------------------------------------------------------------------------- selecteer eerste zichtbare rij na filter en scroll
    ActiveWindow.VisibleRange.Cells(1, 2).Select
End Sub

waar kan de fout zitten?
ben benieuwd en alvast bedankt voor de hulp !!!
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Forum statistics

Threads
1,215,093
Messages
6,123,067
Members
449,090
Latest member
fragment

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