I guess I don't understand the issues involved and maybe I am not going about
this the right way. Here is my code.
Private Sub CommandButton1_Click()
Range("M2:N9").Select
Selection.Clear
Cells(2, 13) = ComboBox1.Text
If ComboBox1.Text <> "" Then
UserForm1.ComboBox1.Text = Format(CDate(ComboBox1.Text), "mm/dd/yyyy")
End If
Cells(3, 13) = ComboBox2.Text
Cells(4, 13) = ComboBox3.Text
Cells(5, 13) = ComboBox4.Text
Cells(6, 13) = ComboBox5.Text
Cells(7, 13) = ComboBox6.Text
Cells(8, 13) = ComboBox7.Text
Cells(9, 13) = ComboBox8.Text
Cells(2, 14) = TextBox1.Text
Cells(3, 14) = TextBox2.Text
Cells(4, 14) = TextBox3.Text
Cells(5, 14) = TextBox4.Text
Cells(6, 14) = TextBox5.Text
Cells(7, 14) = TextBox6.Text
Cells(8, 14) = TextBox7.Text
Cells(9, 14) = TextBox8.Text
Unload UserForm1
End Sub
Dates are in a named range and flow into the combo boxes (up to 8, but all 8
may not be used). Anyway, there can be values that correspond to each of
these dates (up to 8) and there are entered into the textboxes. I've
formatted textboxes before using this technique:
If TextBox1.Text <> "" Then
TextBox1.Text = Format(CDbl(TextBox1.Text), "#,##0.00")
End If
I guess ti is different, somehow, for dates. As it is now, when I click the
down arrow on a combobox, the dates will show up in date format, such as
4/1/2008. Then, when I select the date, 39539 is displayed in the combobox.
When I click the controlbutton to enter the value into the sheet, I see
39539, but I can just change the formatting with a few lones of code towards
the end of the macro:
Columns("M:M").Select
Selection.NumberFormat = "m/d/yyyy"
Columns("N:N").Select
Selection.NumberFormat = "#,##0.00"
Peter, I didn't try your code yet, because I didn't really know how to
implement it in the structure of my [program. I'll try it now.
Thanks for all the help!!