#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default ComboBox

Hello! I have a ComboBox being populated with a named range of dates
(called date). In another cell (named range "default") I have todays date.
How can I have the value in the combobox default to todays date, or
essentially default to the named range "default"? Thanks in advance!!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default ComboBox

How about just setting the value?

me.combobox1.value = format(date,"mm/dd/yyyy")





Steph wrote:

Hello! I have a ComboBox being populated with a named range of dates
(called date). In another cell (named range "default") I have todays date.
How can I have the value in the combobox default to todays date, or
essentially default to the named range "default"? Thanks in advance!!


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default ComboBox

I tried that, but I'm not sure where to put that line of code. I tried it
at the beginning of my showform code below, but errored:

Sub ShowUserForm()

ComboBox1.Value = Worksheets("Sheet2").Range("A1").Value
UserForm1.Show

End Sub
"Dave Peterson" wrote in message
...
How about just setting the value?

me.combobox1.value = format(date,"mm/dd/yyyy")





Steph wrote:

Hello! I have a ComboBox being populated with a named range of dates
(called date). In another cell (named range "default") I have todays
date.
How can I have the value in the combobox default to todays date, or
essentially default to the named range "default"? Thanks in advance!!


--

Dave Peterson



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default ComboBox

Try putting it in the _initialize procedure (behind the userform):

Private Sub UserForm_Initialize()
me.ComboBox1.Value = Worksheets("Sheet2").Range("A1").Value
'or
me.ComboBox1.Value = Worksheets("Sheet2").Range("A1").Text
'or
me.ComboBox1.Value _
= format(Worksheets("Sheet2").Range("A1").Value, "mm/dd/yyyy")
End Sub

Only use one of those, though.


Steph wrote:

I tried that, but I'm not sure where to put that line of code. I tried it
at the beginning of my showform code below, but errored:

Sub ShowUserForm()

ComboBox1.Value = Worksheets("Sheet2").Range("A1").Value
UserForm1.Show

End Sub
"Dave Peterson" wrote in message
...
How about just setting the value?

me.combobox1.value = format(date,"mm/dd/yyyy")





Steph wrote:

Hello! I have a ComboBox being populated with a named range of dates
(called date). In another cell (named range "default") I have todays
date.
How can I have the value in the combobox default to todays date, or
essentially default to the named range "default"? Thanks in advance!!


--

Dave Peterson


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default ComboBox

None of them worked. I am so confused!!

"Dave Peterson" wrote in message
...
Try putting it in the _initialize procedure (behind the userform):

Private Sub UserForm_Initialize()
me.ComboBox1.Value = Worksheets("Sheet2").Range("A1").Value
'or
me.ComboBox1.Value = Worksheets("Sheet2").Range("A1").Text
'or
me.ComboBox1.Value _
= format(Worksheets("Sheet2").Range("A1").Value, "mm/dd/yyyy")
End Sub

Only use one of those, though.


Steph wrote:

I tried that, but I'm not sure where to put that line of code. I tried
it
at the beginning of my showform code below, but errored:

Sub ShowUserForm()

ComboBox1.Value = Worksheets("Sheet2").Range("A1").Value
UserForm1.Show

End Sub
"Dave Peterson" wrote in message
...
How about just setting the value?

me.combobox1.value = format(date,"mm/dd/yyyy")





Steph wrote:

Hello! I have a ComboBox being populated with a named range of dates
(called date). In another cell (named range "default") I have todays
date.
How can I have the value in the combobox default to todays date, or
essentially default to the named range "default"? Thanks in advance!!

--

Dave Peterson


--

Dave Peterson





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default ComboBox

What did you do and what happened when you tried it?



Steph wrote:

None of them worked. I am so confused!!

"Dave Peterson" wrote in message
...
Try putting it in the _initialize procedure (behind the userform):

Private Sub UserForm_Initialize()
me.ComboBox1.Value = Worksheets("Sheet2").Range("A1").Value
'or
me.ComboBox1.Value = Worksheets("Sheet2").Range("A1").Text
'or
me.ComboBox1.Value _
= format(Worksheets("Sheet2").Range("A1").Value, "mm/dd/yyyy")
End Sub

Only use one of those, though.


Steph wrote:

I tried that, but I'm not sure where to put that line of code. I tried
it
at the beginning of my showform code below, but errored:

Sub ShowUserForm()

ComboBox1.Value = Worksheets("Sheet2").Range("A1").Value
UserForm1.Show

End Sub
"Dave Peterson" wrote in message
...
How about just setting the value?

me.combobox1.value = format(date,"mm/dd/yyyy")





Steph wrote:

Hello! I have a ComboBox being populated with a named range of dates
(called date). In another cell (named range "default") I have todays
date.
How can I have the value in the combobox default to todays date, or
essentially default to the named range "default"? Thanks in advance!!

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default ComboBox

In the vbe, I double-clicked on the user form itself (not the buttons or
combobox) which created the following private sub:

Private Sub UserForm_Click()

End Sub

I put this line of your code in the
Me.ComboBox1.Value _
= Format(Worksheets("Sheet2").Range("A1").Value, "mm/dd/yyyy")

I then ran the sub I created to show the userform:
Sub ShowUserForm()
UserForm1.Show
End Sub

The userform shows, but the combobox is not populated with the default value
in Worksheets("Sheet2").Range("A1").


"Dave Peterson" wrote in message
...
What did you do and what happened when you tried it?



Steph wrote:

None of them worked. I am so confused!!

"Dave Peterson" wrote in message
...
Try putting it in the _initialize procedure (behind the userform):

Private Sub UserForm_Initialize()
me.ComboBox1.Value = Worksheets("Sheet2").Range("A1").Value
'or
me.ComboBox1.Value = Worksheets("Sheet2").Range("A1").Text
'or
me.ComboBox1.Value _
= format(Worksheets("Sheet2").Range("A1").Value, "mm/dd/yyyy")
End Sub

Only use one of those, though.


Steph wrote:

I tried that, but I'm not sure where to put that line of code. I
tried
it
at the beginning of my showform code below, but errored:

Sub ShowUserForm()

ComboBox1.Value = Worksheets("Sheet2").Range("A1").Value
UserForm1.Show

End Sub
"Dave Peterson" wrote in message
...
How about just setting the value?

me.combobox1.value = format(date,"mm/dd/yyyy")





Steph wrote:

Hello! I have a ComboBox being populated with a named range of
dates
(called date). In another cell (named range "default") I have
todays
date.
How can I have the value in the combobox default to todays date, or
essentially default to the named range "default"? Thanks in
advance!!

--

Dave Peterson

--

Dave Peterson


--

Dave Peterson



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default ComboBox

Don't use _click. Use _initialize.


Steph wrote:

In the vbe, I double-clicked on the user form itself (not the buttons or
combobox) which created the following private sub:

Private Sub UserForm_Click()

End Sub

I put this line of your code in the
Me.ComboBox1.Value _
= Format(Worksheets("Sheet2").Range("A1").Value, "mm/dd/yyyy")

I then ran the sub I created to show the userform:
Sub ShowUserForm()
UserForm1.Show
End Sub

The userform shows, but the combobox is not populated with the default value
in Worksheets("Sheet2").Range("A1").

"Dave Peterson" wrote in message
...
What did you do and what happened when you tried it?



Steph wrote:

None of them worked. I am so confused!!

"Dave Peterson" wrote in message
...
Try putting it in the _initialize procedure (behind the userform):

Private Sub UserForm_Initialize()
me.ComboBox1.Value = Worksheets("Sheet2").Range("A1").Value
'or
me.ComboBox1.Value = Worksheets("Sheet2").Range("A1").Text
'or
me.ComboBox1.Value _
= format(Worksheets("Sheet2").Range("A1").Value, "mm/dd/yyyy")
End Sub

Only use one of those, though.


Steph wrote:

I tried that, but I'm not sure where to put that line of code. I
tried
it
at the beginning of my showform code below, but errored:

Sub ShowUserForm()

ComboBox1.Value = Worksheets("Sheet2").Range("A1").Value
UserForm1.Show

End Sub
"Dave Peterson" wrote in message
...
How about just setting the value?

me.combobox1.value = format(date,"mm/dd/yyyy")





Steph wrote:

Hello! I have a ComboBox being populated with a named range of
dates
(called date). In another cell (named range "default") I have
todays
date.
How can I have the value in the combobox default to todays date, or
essentially default to the named range "default"? Thanks in
advance!!

--

Dave Peterson

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default ComboBox

That did it! Thanks Dave!!!

"Dave Peterson" wrote in message
...
Don't use _click. Use _initialize.


Steph wrote:

In the vbe, I double-clicked on the user form itself (not the buttons or
combobox) which created the following private sub:

Private Sub UserForm_Click()

End Sub

I put this line of your code in the
Me.ComboBox1.Value _
= Format(Worksheets("Sheet2").Range("A1").Value, "mm/dd/yyyy")

I then ran the sub I created to show the userform:
Sub ShowUserForm()
UserForm1.Show
End Sub

The userform shows, but the combobox is not populated with the default
value
in Worksheets("Sheet2").Range("A1").

"Dave Peterson" wrote in message
...
What did you do and what happened when you tried it?



Steph wrote:

None of them worked. I am so confused!!

"Dave Peterson" wrote in message
...
Try putting it in the _initialize procedure (behind the userform):

Private Sub UserForm_Initialize()
me.ComboBox1.Value = Worksheets("Sheet2").Range("A1").Value
'or
me.ComboBox1.Value = Worksheets("Sheet2").Range("A1").Text
'or
me.ComboBox1.Value _
= format(Worksheets("Sheet2").Range("A1").Value, "mm/dd/yyyy")
End Sub

Only use one of those, though.


Steph wrote:

I tried that, but I'm not sure where to put that line of code. I
tried
it
at the beginning of my showform code below, but errored:

Sub ShowUserForm()

ComboBox1.Value = Worksheets("Sheet2").Range("A1").Value
UserForm1.Show

End Sub
"Dave Peterson" wrote in message
...
How about just setting the value?

me.combobox1.value = format(date,"mm/dd/yyyy")





Steph wrote:

Hello! I have a ComboBox being populated with a named range of
dates
(called date). In another cell (named range "default") I have
todays
date.
How can I have the value in the combobox default to todays date,
or
essentially default to the named range "default"? Thanks in
advance!!

--

Dave Peterson

--

Dave Peterson

--

Dave Peterson


--

Dave Peterson



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
fill combobox depending on selection from another combobox Adam Francis Excel Discussion (Misc queries) 2 July 24th 08 07:39 PM
Combobox items determined by the selection in another combobox Alerion Excel Programming 2 September 13th 06 01:07 PM
Combobox options based on the input of another combobox afmullane[_5_] Excel Programming 1 May 3rd 06 01:44 PM
ComboBox list reliant on the entry from a different ComboBox ndm berry[_2_] Excel Programming 4 October 4th 05 04:40 PM
How Do I Load A ComboBox RowSource From The Results Of Another ComboBox Minitman[_4_] Excel Programming 3 October 26th 04 07:58 PM


All times are GMT +1. The time now is 04:36 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"