Find & activate cell containing current date on 12 month calendar

DFragnDragn

Board Regular
Joined
Mar 6, 2010
Messages
81
I have a 12 month calendar. All 12 months are within Range C5:Y39.
FindString = Format(dValue, "d") is only finding the first instance (current Day) which is Jan.
Changing the format value to "m" gets me into Feb., but with the wrong day. I've tried every Format value I can think of and they all fail completely except for d & m.
I can't get it to find the proper month with appropriate day.

Any direction would be much appreciated.

Code:
Sub FindDate()
    Dim FindString As String
    Dim Rng As Range
    Dim dValue As String
    dValue = Date
    FindString = Format(dValue, "d")
    If Trim(FindString) <> "" Then
        With ActiveSheet.Range("C5:Y39")
            Set Rng = .Find(What:=FindString, _
                            After:=.Cells(.Cells.Count), _
                            LookIn:=xlValues, _
                            LookAt:=xlWhole, _
                            SearchOrder:=xlByRows, _
                            SearchDirection:=xlNext, _
                            MatchCase:=False)
            If Not Rng Is Nothing Then
            MsgBox Rng.Value
            Application.Goto Rng
            Else
                MsgBox "Nothing found"
            End If
        End With
    End If
End Sub
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
SOLVED with new direction

Named my 12 month calendar display Range and went a different direction with this code:
Code:
Sub FindDate()
Dim found As Boolean: found = False
For Each cl In Range("CalFindRngDate")
    If cl.Value = Date Then
        found = True
        Exit For
    End If
Next cl
If found Then
Application.Goto cl
     MsgBox cl.Value
Else
     MsgBox "Not Found"
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,831
Members
452,946
Latest member
JoseDavid

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