rij met volgende chronologisch item bovenaan plaatsen

littlepete

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

ik heb een adressenlijst-agenda met alle gegevens van familie en vrienden.
de zes eerste kolommen zijn zichtbaar en vullen het scherm. de kolommen g tot en met by bevatten alle courante gegevens...
telkens naast de kolom van geboortedatum, overlijdensdatum, trouwdatum, ... staat een kolom die de datum in getal weergeeft: geboren op 19/4 wordt zo 04191;
overleden op 17 maart 2020 is dan 03173...

filteren en sorteren lukt prima, maar de gevraagde lijsten (bv. alle overlijdens in april,alle trouwdata in augustus,...) zijn steeds langer dan het scherm. en bovenaan
het scherm staat steeds het eerste item van de gevraagde maand.

hoe kan ik de lijst verschuiven zodat de eerst zichtbare rij bovenaan een item van vandaag of de eerstvolgende dagen is?
 
inderdaad : eerst 01011 geboorte op 1 januari... 02152 getrouwd op 15 februari... tot als laatste 12316 hertrouwd op 31 december ...
 
Upvote 0

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Kan u de hele kolom BH eens opmaken als tekst. (Start - Getal - Getalnotatie --> Tekst)
Op welke rij begint de tabel? De rij dus onder de kolomtitels.
 
Upvote 0
hallo,

nogmaals dank voor de hulp !

de hele kolom BH is opgemaakt als tekst. de eerste rij in gebruik is 5.

thx !
 

Attachments

  • 2021-03-04 (2).png
    2021-03-04 (2).png
    181.7 KB · Views: 14
Upvote 0
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("BH" & Rows.Count).End(xlUp).Row
    Set rng = Range("BH" & firstrow & ":BH" & lastrow) 'Range("BH:BH")
    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
 
Upvote 0
Solution
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("BH" & Rows.Count).End(xlUp).Row
    Set rng = Range("BH" & firstrow & ":BH" & lastrow) 'Range("BH:BH")
    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
vba als hobby hebben is eigenlijk een dubbele hobby ! eerst het zoeken en puzzelen tot alle stukjes passen, en daarna: het bestuderen van de code die werkt en het resultaat juist weergeeft !

voor mij begint deel twee nu :) !!! hartelijk dank voor de hulp het resultaat is mooi en netjes :) !!! mooie dag nog :) !!!
nu alleen zoeken waar ik kan markeren dat het probleem is opgelost ...

dankuwel !
 
Upvote 0
ik heb een vervolgvraagje gesteld in verband met boolean variables :)
 
Upvote 0

Forum statistics

Threads
1,214,877
Messages
6,122,051
Members
449,064
Latest member
scottdog129

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