Calendar Control script

Fyr

Active Member
Joined
Jan 20, 2009
Messages
375
I have a request for a script.
I have calendar control imbedded into my worksheet sheet1.
I if a user clicks on a date, and hits a button, i want the script to search sheet2 column A for the date and set a variable with the row number the date was found in.

is this possible?

Thanks for taking a look!
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
ok, I find out how to get the date that is selected in the calendar. Calendar1.Value.
this is how I would it would run:

Sub example()
Calendar1.Value
' search sheet2 for date selected in column A
' set a variable the row number in located at.
End Sub

something to that effect.
 
Upvote 0
Something like this:
Code:
Sub test()
    Dim row As Long
    row = DateRow
End Sub

Public Function DateRow() As Long
    Dim findDate As Range
        
    DateRow = 0
    With Sheets("Sheet2").Columns("A:A")
        Set findDate = .Find(What:=Calendar1.Value, LookIn:=xlValues)
        If Not findDate Is Nothing Then DateRow = findDate.row
    End With
End Function
 
Upvote 0

Forum statistics

Threads
1,226,216
Messages
6,189,675
Members
453,563
Latest member
Aswathimsanil

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