ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   User Form with dropdown item (https://www.excelbanter.com/excel-discussion-misc-queries/221444-user-form-dropdown-item.html)

Gene Augustin

User Form with dropdown item
 
I want to create a user form to to create a variable value to one of four
values using a dropdown list with the name Account_Number: "CC Account #"


The form name is Select_CC_Bank()
I don't want to pre-define these variavles as cells on the worksheet.
I want the Form to select a 4 digit integer numerical value, different for
each item, only one value will be chosen.

I have predefined the values:


Private Sub UserForm_Initialize()
' Add pre-defined choices

' Do I define Name.AT&T-Visa = "1234" "don't know if this is the correct
' format and the others before or after the form, or does it not matter?

Name.USAir-VISA = "3214" ' assuming this is the correct format
Name.AT&T-Visa = "1234" ' are the quotes needed for number value?
Name.Capitol1-VISA = "4123"
Name.CASH = "1324"

cb_CCBank.AddItem "USAir-VISA"
cb_CCBank.AddItem "AT&T-MC"
cb_CCBank.AddItem "Capitol1-VISA"
cb_CCBank.AddItem "CASH"
cb_CCBank.AddItem " "
End Sub

I want the Form to select the 4 digit integer numerical value, different for
and based on each item, only one value will be chosen by the form, then OK.
How do I know what was returned by the form?


Private Sub UserForm_SetVariable()
AcctNo = Returned_variable 'I think this puts the numerical 1234 in
' the variable AcctNo
EndSub



The rest of the usage of the value of the variable in the macro is pretty
simple and I think Ican handle it.
After OK, the rest of the macro will set the variable name, change the tab
name and select a region and insert that numerical value in every cell in
the region.

I'm working from Bill Jelen's book and Chapter 9 is not too clear in the
forms area, although the first 8 chapters are very useful

Gene



All times are GMT +1. The time now is 08:20 PM.

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