Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default UserForm specs

Hello all,

using excel '03

I have a userform that initializes several values in both comboboxes
and textboxes.

In one of those textboxes, I would like today() (in yyyymmdd format)
to be the default value.

Can I do this and how?

thanks,
alex

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default UserForm specs

Private Sub Userform_Activate

TextBox1.Text = Format(Date, "yyyymmdd")
End Sub

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"alex" wrote in message
...
Hello all,

using excel '03

I have a userform that initializes several values in both comboboxes
and textboxes.

In one of those textboxes, I would like today() (in yyyymmdd format)
to be the default value.

Can I do this and how?

thanks,
alex



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default UserForm specs

Hi Alex

The code below would be one way to do it.

Private Sub UserForm_Initialize()

TextBox1.Value = Format(Now, "YYYY - MM - DD")

End Sub

Hope this helps

Steve
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default UserForm specs

On May 19, 7:33*am, Incidental wrote:
Hi Alex

The code below would be one way to do it.

Private Sub UserForm_Initialize()

TextBox1.Value = Format(Now, "YYYY - MM - DD")

End Sub

Hope this helps

Steve


Thanks Bob and Steve; it worked perfectly. While I've got your
attention...Do you know the best way to add a list to a combobox? I'm
currently using .AddItem, but with a long list, it's a bit tedious.

thanks again,
alex
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default UserForm specs


Private Sub UserForm_Activate()
Dim aryValues As Variant

aryValues = Range("A1:A20")
Me.ComboBox1.List = aryValues
End Sub


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"alex" wrote in message
...
On May 19, 7:33 am, Incidental wrote:
Hi Alex

The code below would be one way to do it.

Private Sub UserForm_Initialize()

TextBox1.Value = Format(Now, "YYYY - MM - DD")

End Sub

Hope this helps

Steve


Thanks Bob and Steve; it worked perfectly. While I've got your
attention...Do you know the best way to add a list to a combobox? I'm
currently using .AddItem, but with a long list, it's a bit tedious.

thanks again,
alex




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default UserForm specs

On May 19, 8:25*am, "Bob Phillips" wrote:
Private Sub UserForm_Activate()
Dim aryValues As Variant

* * aryValues = Range("A1:A20")
* * Me.ComboBox1.List = aryValues
End Sub

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"alex" wrote in message

...
On May 19, 7:33 am, Incidental wrote:

Hi Alex


The code below would be one way to do it.


Private Sub UserForm_Initialize()


TextBox1.Value = Format(Now, "YYYY - MM - DD")


End Sub


Hope this helps


Steve


Thanks Bob and Steve; it worked perfectly. *While I've got your
attention...Do you know the best way to add a list to a combobox? *I'm
currently using .AddItem, but with a long list, it's a bit tedious.

thanks again,
alex


Thanks again Bob...I'd like to not reference anything on the
worksheet. I'm assuming I can still set up some kind of array.
aryValues = ?
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default UserForm specs

Yes you can, you can even do it directly

Private Sub UserForm_Activate()
Me.ComboBox1.List = Array("Bob", "Alex", "Jim", "Noel", "Pete")
End Sub


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"alex" wrote in message
...
On May 19, 8:25 am, "Bob Phillips" wrote:
Private Sub UserForm_Activate()
Dim aryValues As Variant

aryValues = Range("A1:A20")
Me.ComboBox1.List = aryValues
End Sub

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"alex" wrote in message

...
On May 19, 7:33 am, Incidental wrote:

Hi Alex


The code below would be one way to do it.


Private Sub UserForm_Initialize()


TextBox1.Value = Format(Now, "YYYY - MM - DD")


End Sub


Hope this helps


Steve


Thanks Bob and Steve; it worked perfectly. While I've got your
attention...Do you know the best way to add a list to a combobox? I'm
currently using .AddItem, but with a long list, it's a bit tedious.

thanks again,
alex


Thanks again Bob...I'd like to not reference anything on the
worksheet. I'm assuming I can still set up some kind of array.
aryValues = ?


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default UserForm specs

In addition to the Array function method Bob posted, there is this
alternative (which, if you are like me and hate typing multiple quote marks
if you can help it) you might want to consider...

Private Sub UserForm_Activate()
ComboBox1.List = Split("Item 1,Item 2,Item 3,Item 4,Item 5", ",")
End Sub

where you can use any delimiter character you want so long as it is not in
any of the items in the list.

Rick


"alex" wrote in message
...
On May 19, 8:25 am, "Bob Phillips" wrote:
Private Sub UserForm_Activate()
Dim aryValues As Variant

aryValues = Range("A1:A20")
Me.ComboBox1.List = aryValues
End Sub

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"alex" wrote in message

...
On May 19, 7:33 am, Incidental wrote:

Hi Alex


The code below would be one way to do it.


Private Sub UserForm_Initialize()


TextBox1.Value = Format(Now, "YYYY - MM - DD")


End Sub


Hope this helps


Steve


Thanks Bob and Steve; it worked perfectly. While I've got your
attention...Do you know the best way to add a list to a combobox? I'm
currently using .AddItem, but with a long list, it's a bit tedious.

thanks again,
alex


Thanks again Bob...I'd like to not reference anything on the
worksheet. I'm assuming I can still set up some kind of array.
aryValues = ?

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
Excel performance vs computer specs CLR Excel Discussion (Misc queries) 2 March 19th 07 11:32 AM
Global Print Specs Steve Williams Excel Worksheet Functions 0 November 21st 05 09:37 PM
Global Print Specs Steve Williams Excel Discussion (Misc queries) 0 November 18th 05 06:16 PM
Help - Loosing my settings and my mind. <-- specs OhMizerWord Excel Discussion (Misc queries) 1 March 29th 05 12:47 AM
Specs of formats Biff Excel Discussion (Misc queries) 2 January 27th 05 02:34 AM


All times are GMT +1. The time now is 05:07 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"