User Form issues
you want one listbox with each month year combination?
With worksheets("Dates")
for each cell in .Range("B2:B32")
for each i = 1 to 12
useform1.listbox1.AddItem format(DateSerial(cell,i,1),"m/yy")
Next
Next
End with
then in you click event for the listbox
Private Sub Listbox1_click()
Dim s as String, iloc as Long, m as String, y as String
s= Listbox1.Value
iloc = Instr(1,s,"/",vbTextcompare)
m = Left(s,iloc-1)
y = "20" & Right(s,len(s)-iloc)
dt = DateSerial(clng(y),clng(m),1)
activecell.Value = dt
activecell.Numberformat = "m/yy"
End Sub
--
Regards,
Tom Ogilvy
"Barb Reinhardt" wrote:
I posted another user form question and I'm not sure it was posted as I got
an error message. As I'm a novice to user forms, I'm hoping this is easy to
the experts.
I have a user form where I want the user to enter the month and date using
combo boxes. I've gotten the combo boxes to work, but am not sure how to
pull the data back into the active worksheet. The name of the combo boxes
is cboMonth and cboYear. Can someone assist?
Thanks
|