ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   UserForm specs (https://www.excelbanter.com/excel-programming/411158-userform-specs.html)

alex

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


Bob Phillips

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




Incidental

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

alex

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

Bob Phillips

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



alex

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 = ?

Bob Phillips

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 = ?



Rick Rothstein \(MVP - VB\)[_1966_]

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 = ?


Bob Phillips

UserForm specs
 
Good point, they must be the most annoying character on the keyboard.

--
---
HTH

Bob


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



"Rick Rothstein (MVP - VB)" wrote in
message ...
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 = ?




alex

UserForm specs
 
On May 19, 2:08*pm, "Bob Phillips" wrote:
Good point, they must be the most annoying character on the keyboard.

--
---
HTH

Bob

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

"Rick Rothstein (MVP - VB)" wrote in
. ..



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 = ?- Hide quoted text -


- Show quoted text -


Thanks Bob and Rick. Your help is most appreciated.
alex

Rick Rothstein \(MVP - VB\)[_1974_]

UserForm specs
 
Tell me about it. I've been touch-typing for many, many years now and, when
not looking at the keyboard, I still tend to overshoot the quote mark key
for the Enter key more often than not. The odds that I would have been able
to touch-type the Array function assignment statement you posted, short as
it was, without missing the quote mark key at least once is nearly nil.

Rick


"Bob Phillips" wrote in message
...
Good point, they must be the most annoying character on the keyboard.

--
---
HTH

Bob


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



"Rick Rothstein (MVP - VB)" wrote in
message ...
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 = ?





Bob Phillips

UserForm specs
 
That is not my problem. On UK keyboards the " is above the 2 on the top line
numbers. I am a very bad typist, and trying to get the right hand second
finger on the shift key , and the left hand second finger on the 2 is
problematical for me, most other shifts I drive from my left hand. And there
are so many of them.

--
---
HTH

Bob


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



"Rick Rothstein (MVP - VB)" wrote in
message ...
Tell me about it. I've been touch-typing for many, many years now and,
when not looking at the keyboard, I still tend to overshoot the quote mark
key for the Enter key more often than not. The odds that I would have been
able to touch-type the Array function assignment statement you posted,
short as it was, without missing the quote mark key at least once is
nearly nil.

Rick


"Bob Phillips" wrote in message
...
Good point, they must be the most annoying character on the keyboard.

--
---
HTH

Bob


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



"Rick Rothstein (MVP - VB)" wrote
in message ...
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 = ?







Rick Rothstein \(MVP - VB\)[_1978_]

UserForm specs
 
That is interesting... it never occurred to me that "English" keyboards
would be laid out differently. Just out of curiosity, where is the @ symbol
(what is in the Shift+2 key on my keyboard)?

Rick


"Bob Phillips" wrote in message
...
That is not my problem. On UK keyboards the " is above the 2 on the top
line numbers. I am a very bad typist, and trying to get the right hand
second finger on the shift key , and the left hand second finger on the 2
is problematical for me, most other shifts I drive from my left hand. And
there are so many of them.

--
---
HTH

Bob


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



"Rick Rothstein (MVP - VB)" wrote in
message ...
Tell me about it. I've been touch-typing for many, many years now and,
when not looking at the keyboard, I still tend to overshoot the quote
mark key for the Enter key more often than not. The odds that I would
have been able to touch-type the Array function assignment statement you
posted, short as it was, without missing the quote mark key at least once
is nearly nil.

Rick


"Bob Phillips" wrote in message
...
Good point, they must be the most annoying character on the keyboard.

--
---
HTH

Bob


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



"Rick Rothstein (MVP - VB)" wrote
in message ...
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 = ?







Bob Phillips

UserForm specs
 
That is the shifted key two to the left of the Enter key, above the single
quote mark. # and tilde ~ are on the key adjacent to the Enter key.

--
---
HTH

Bob


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



"Rick Rothstein (MVP - VB)" wrote in
message ...
That is interesting... it never occurred to me that "English" keyboards
would be laid out differently. Just out of curiosity, where is the @
symbol (what is in the Shift+2 key on my keyboard)?

Rick


"Bob Phillips" wrote in message
...
That is not my problem. On UK keyboards the " is above the 2 on the top
line numbers. I am a very bad typist, and trying to get the right hand
second finger on the shift key , and the left hand second finger on the 2
is problematical for me, most other shifts I drive from my left hand. And
there are so many of them.

--
---
HTH

Bob


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



"Rick Rothstein (MVP - VB)" wrote
in message ...
Tell me about it. I've been touch-typing for many, many years now and,
when not looking at the keyboard, I still tend to overshoot the quote
mark key for the Enter key more often than not. The odds that I would
have been able to touch-type the Array function assignment statement you
posted, short as it was, without missing the quote mark key at least
once is nearly nil.

Rick


"Bob Phillips" wrote in message
...
Good point, they must be the most annoying character on the keyboard.

--
---
HTH

Bob


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



"Rick Rothstein (MVP - VB)" wrote
in message ...
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 = ?









Norman Jones[_2_]

UserForm specs
 
Hi Rick,

See:

http://en.wikipedia.org/wiki/Keyboar...UK_and_Ireland



---
Regards.
Norman

Rick Rothstein \(MVP - VB\)[_1979_]

UserForm specs
 
Thanks Norm (I should have realized wikipedia would have an article on
this). The interesting thing is the letter layout is QWERTY and, while most
of the non-letters are located in the same position, not all of them are.
There are extra keys on the UK keyboard (compared to the US keyboard) next
to the apostrophe key and the Z key and one key missing next to the closing
square bracket key (it is the key that is next to the Z key).

Rick


"Norman Jones" wrote in message
...
Hi Rick,

See:

http://en.wikipedia.org/wiki/Keyboar...UK_and_Ireland



---
Regards.
Norman




All times are GMT +1. The time now is 09:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com