ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Userform Initialize & combo box values (https://www.excelbanter.com/excel-discussion-misc-queries/96287-userform-initialize-combo-box-values.html)

michaelberrier

Userform Initialize & combo box values
 
I have the following code for populating a combobox with numbers 1-10.
Is there a way to change it to display letters instead of numbers?

Private Sub UserForm_Initialize()
Dim iCtr As Long
For iCtr = 1 To 10
Me.ComboBox1.AddItem iCtr
Next iCtr
End Sub

Thanks to all.


baxybaxy

Userform Initialize & combo box values
 

isn't there a char() function in vba?

can you add 64 to ictr and set the value to char(ictr)?


--
baxybaxy
------------------------------------------------------------------------
baxybaxy's Profile: http://www.excelforum.com/member.php...o&userid=35824
View this thread: http://www.excelforum.com/showthread...hreadid=556059


Chip Pearson

Userform Initialize & combo box values
 
There is the Chr function that returns a string based on the
ASCII value passed in. E.g.,

Debug.Print Chr(48)


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"baxybaxy"
wrote in
message
...

isn't there a char() function in vba?

can you add 64 to ictr and set the value to char(ictr)?


--
baxybaxy
------------------------------------------------------------------------
baxybaxy's Profile:
http://www.excelforum.com/member.php...o&userid=35824
View this thread:
http://www.excelforum.com/showthread...hreadid=556059




michaelberrier

Userform Initialize & combo box values
 
I've tried adding this several places, but I get a "permission denied"
error. Where would I put this?

Chip Pearson wrote:
There is the Chr function that returns a string based on the
ASCII value passed in. E.g.,

Debug.Print Chr(48)


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"baxybaxy"
wrote in
message
...

isn't there a char() function in vba?

can you add 64 to ictr and set the value to char(ictr)?


--
baxybaxy
------------------------------------------------------------------------
baxybaxy's Profile:
http://www.excelforum.com/member.php...o&userid=35824
View this thread:
http://www.excelforum.com/showthread...hreadid=556059




All times are GMT +1. The time now is 12:31 AM.

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