Scroll to column that contains date today

  • Hello,


    I placed a question, but got no answer, so I think it is better to split the problems.
    With the code


    Code
    Sub GaNaarKolomVandaag()
    Dim c As Range
    For Each c In Range("O1:NS1")
    If c = Now() Then
    ActiveWindow.ScrollColumn = c.Column
    Exit Sub
    End If
    Next c
    End Sub


    I try to go to the column with date today in the first row.
    I prefer that the column with date today should be the first row next to the blocked title column.


    But the macro does not work.


    Can somebody help?


    Thanks


    aisietie

  • Re: Scroll to column that contains date today


    Hi


    If I understand you correctly you want to activate the cell with todays date on Row 1. No problemo. Attached is a workbook to show workings, below is the code to get you over the line.


    Take care


    Smallman


    Code
    Option Explicit
    Sub FndDate()
        Dim rng As Range
        Dim dte As Date
        
        dte = Date
        Set rng = Range("A1:NS1").Find(dte)
        rng.Select
    End Sub

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!