Hi all,
this is a minor irritation more than a major problem but I'm flummoxed by it all the same. Rylo and ProtonLeah helped me with some code (thanks guys) for using a userform and spin button to amend data - the code is below
Private Sub UserForm_Initialize()
Me.SpinButton1.Max = Worksheets("data").Cells(Rows.Count, 1).End(xlUp).Row
Me.SpinButton1.Min = 1
SpinButton1.Value = SpinButton1.Max
Private Sub SpinButton1_Change()
Me.ComboBox1.Value = Worksheets("Data").Range("A" & Me.SpinButton1.Value).Value
Me.ComboBox2.Value = Worksheets("Data").Range("B" & Me.SpinButton1.Value).Value
Me.ComboBox3.Value = Worksheets("Data").Range("C" & Me.SpinButton1.Value).Value
Me.TextBox1.Value = Worksheets("Data").Range("D" & Me.SpinButton1.Value).Value
Me.TextBox2.Value = Worksheets("Data").Range("E" & Me.SpinButton1.Value).Value
Me.TextBox3.Value = Worksheets("Data").Range("F" & Me.SpinButton1.Value).Value
Me.TextBox4.Value = Worksheets("Data").Range("G" & Me.SpinButton1.Value).Value
Me.TextBox5.Value = Worksheets("Data").Range("H" & Me.SpinButton1.Value).Value
Me.TextBox6.Value = Worksheets("Data").Range("I" & Me.SpinButton1.Value).Value
Me.TextBox8.Value = Worksheets("Data").Range("J" & Me.SpinButton1.Value).Value
Me.TextBox7.Value = Worksheets("Data").Range("K" & Me.SpinButton1.Value).Value
Application.StatusBar = SpinButton1.Value
'If ComboBox1.Value = "" Then
'MsgBox " There are no more records to show... "
'End If
End Sub
Here's the problem - the date in combobox2 won't display in the format I would like (DD-MMM-YY) - the data in Column B of the "Data" worksheets is just dates (formatted as DD-MMM-YY) - when the userform loads however, the date (eg 5 Jul 12) is displayed as 7/5/12
I tried using a change
Private Sub ComboBox2_Change()
ComboBox2.Value = Format(ComboBox2.Value, "DD-MMM-YY")
End Sub
but this changes the displayed date to 7 May 12 and gives me a "Huh?" moment. What am I missing here?
Cheers,
AJ
Bookmarks