View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff[_4_] Harald Staff[_4_] is offline
external usenet poster
 
Posts: 70
Default Default for Dates in User Form

Hi Ligaya

You must save the choice somewhere. An external text file, in the registry, or in a cell
on a perhaps hiden sheet -here in Sheet3 A1:

Private Sub UserForm_Initialize()
'dummy setup:
Dim D As Date
For D = Date - 15 To Date + 15
ComboBox1.AddItem D
Next
'set last default:
ComboBox1.Text = Sheets(3).Cells(1, 1).Value
End Sub

Private Sub CommandButton1_Click() 'OK button
'save this as default:
Sheets(3).Cells(1, 1).NumberFormat = "@"
Sheets(3).Cells(1, 1).Value = ComboBox1.Text
'rest of actions he
' -- and finally:
Unload Me
End Sub

--
HTH. Best wishes Harald
Excel MVP

Followup to newsgroup only please.

"Ligaya" wrote in message
...
I was just wondering if anybody could help me in making the
last date entry on an input box as the last date to show-up
when a user invoke the userform.

I have a pull down menu on the dates and an option for the
user to type the dates. However, when the user try to
change the date again after the user exit the userform, the
default is not the last date the user entered.

Much obliged for your help.

Ligaya