M Mohammad Ishaq Member Jan 9, 2019 #1 Hello, I have a user form having one text box and a button.I want that when i click on the button,i get only first date of the current month . For example today is Jan 9 2019,i want to get only Jan 01 2019 instead of Jan 9 2019. Attachments Date.xlsm 13.1 KB · Views: 2
Hello, I have a user form having one text box and a button.I want that when i click on the button,i get only first date of the current month . For example today is Jan 9 2019,i want to get only Jan 01 2019 instead of Jan 9 2019.
YasserKhalil Well-Known Member Jan 9, 2019 #2 Try this code Code: Private Sub CommandButton1_Click() TextBox1.Value = Format(DateSerial(Year(Date), Month(Date), 1), "mmm dd yyyy") End Sub
Try this code Code: Private Sub CommandButton1_Click() TextBox1.Value = Format(DateSerial(Year(Date), Month(Date), 1), "mmm dd yyyy") End Sub
M Mohammad Ishaq Member Jan 9, 2019 #3 YasserKhalil said: Try this code Code: Private Sub CommandButton1_Click() TextBox1.Value = Format(DateSerial(Year(Date), Month(Date), 1), "mmm dd yyyy") End Sub Click to expand... Thanks
YasserKhalil said: Try this code Code: Private Sub CommandButton1_Click() TextBox1.Value = Format(DateSerial(Year(Date), Month(Date), 1), "mmm dd yyyy") End Sub Click to expand... Thanks
Deepak Excel Ninja Jan 9, 2019 #4 A Native approach. Code: TextBox1.Value = Format(1 + Application.EoMonth(Date, -1), "mmm dd yyyy")