serenitylai
serenitylai

Reputation: 1

How to output values from cells in Excel to textboxes with date as search parameter

I have this data in Excel: Excel

I have this user form: user form

I click a date in the calendar and then output the data under that date in the first picture. how can i do it?

Upvotes: 0

Views: 59

Answers (1)

ASH
ASH

Reputation: 20322

Let's say your data is in cell D1 . . .

Dim dDate As Date 
Private Sub CommandButton1_Click() 
    Sheet1.Range("D1").Value = dDate 
End Sub 

Private Sub TextBox1_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean) 

     'Dim dDate As Date
    dDate = DateSerial(Year(Date), Month(Date), Day(Date)) 
    TextBox1.Value = Format(TextBox1.Value, "dd/mm/yyyy") 
    dDate = TextBox1.Value 
End Sub 

Upvotes: 1

Related Questions