Date value
On Sat, 22 Nov 2008 10:26:30 -0800, "Patrick C. Simonds"
wrote:
The user inputs a year Value to TextBox1. How can I amend the code below so
that January 1 of the year is inputted to into the cell?
Private Sub CommandButton1_Click()
Dim rng
Set rng = Cells(ActiveCell.Row, 1)
rng(1, 2).Value = TextBox1.Value
Module2.Rename_Worksheets
Unload Year
End Sub
Use the DateSerial function
For example:
rng(1, 2).Value = DateSerial(TextBox1.Value,1,1)
--ron
|