Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


Problems with User Forms


Problems with User Forms

Author
Message
millsy
millsy
Forum God
Forum God (620 reputation)Forum God (620 reputation)Forum God (620 reputation)Forum God (620 reputation)Forum God (620 reputation)Forum God (620 reputation)Forum God (620 reputation)Forum God (620 reputation)Forum God (620 reputation)

Group: Forum Members
Posts: 2, Visits: 8
I am trying to place combo boxes in UserForm and the info in Combo box keeps duplicating which is causing me to have lots of 'phone' and 'internet'.  Is it something to do with the declaration?

Also I am trying to figure out how I can have a UserForm which will find User ID data and place information into the User ID column.  Is this possible? 

Would really appreciate any help.

Thanks

Millsy

Smile

Dim StockCodeValue As String
Dim InputSheetName As String

Private Sub CloseButton_Click()

InputForm.Hide

End Sub

Private Sub Clear_Click()

InputForm.ExpiryDate.Value = ""
InputForm.PhoneInternet.Value = ""
InputForm.SizeContract.Value = ""
InputForm.StockCode.Value = ""
InputForm.StrikePrice.Value = ""
InputForm.OptionCode.Value = ""
InputForm.NoContracts.Value = ""
InputForm.Premium.Value = ""
InputForm.TransactionDate.Value = ""

End Sub

Private Sub ExpiryDate_Enter()

InputForm.ExpiryDate.AddItem ("Jul 08")
InputForm.ExpiryDate.AddItem ("Aug 08")
InputForm.ExpiryDate.AddItem ("Sept 08")
InputForm.ExpiryDate.AddItem ("Oct 08")
InputForm.ExpiryDate.AddItem ("Nov 08")
InputForm.ExpiryDate.AddItem ("Dec 08")
InputForm.ExpiryDate.AddItem ("Jan 09")
InputForm.ExpiryDate.AddItem ("Feb 09")
InputForm.ExpiryDate.AddItem ("Mar 09")
InputForm.ExpiryDate.AddItem ("Apr 09")
InputForm.ExpiryDate.AddItem ("May 09")
InputForm.ExpiryDate.AddItem ("Jun 09")

InputForm.ExpiryDate = ""

InputForm.ExpiryDate.ListIndex = 0

InputForm.ExpiryDate.MatchRequired = True

End Sub

Private Sub PhoneInternet_Enter()

InputForm.PhoneInternet.AddItem ("Internet")
InputForm.PhoneInternet.AddItem ("Phone")

InputForm.PhoneInternet = ""

InputForm.PhoneInternet.MatchRequired = True

End Sub

Private Sub SizeContract_Enter()

InputForm.SizeContract.AddItem ("1000")

End Sub

Private Sub UpdateButton_Click()

InputSheetName = "Peak 3 Put Writing"
StockCodeValue = InputForm.StockCode.Value
StrikePriceValue = InputForm.StrikePrice.Value
TransactionDateValue = InputForm.TransactionDate.Value
PremiumValue = InputForm.Premium.Value
OptionCodeValue = InputForm.OptionCode.Value
PhoneInternetValue = InputForm.PhoneInternet.Value
NoContractsValue = InputForm.NoContracts.Value
SizeContractValue = InputForm.SizeContract.Value
ExpiryDateValue = InputForm.ExpiryDate.Value

ActiveWorkbook.Worksheets(InputSheetName).Select

Dim Home As Range

Set Home = Range("A1")

Home.Offset(3, 0).Select

Range(Selection, Selection.End(xlToRight)).Select

Dim NumColsUsed As Integer
NumColsUsed = Selection.Columns.Count

Home.Offset(0, NumColsUsed).Value = StockCodeValue
Home.Offset(6, NumColsUsed).Value = StrikePriceValue
Home.Offset(4, NumColsUsed).Value = TransactionDateValue
Home.Offset(9, NumColsUsed).Value = PremiumValue
Home.Offset(1, NumColsUsed).Value = OptionCodeValue
Home.Offset(3, NumColsUsed).Value = PhoneInternetValue
Home.Offset(7, NumColsUsed).Value = NoContractsValue
Home.Offset(8, NumColsUsed).Value = SizeContractValue
Home.Offset(5, NumColsUsed).Value = ExpiryDateValue


End Sub

Keithuk
Keithuk
Forum God
Forum God (298K reputation)

Group: Moderators
Posts: 1.9K, Visits: 5.5K
millsy (8/6/2008)
I am trying to place combo boxes in UserForm and the info in Combo box keeps duplicating which is causing me to have lots of 'phone' and 'internet'.

You can check a ComboBox or ListBox for duplicates before you add anything to them. Wink

Keith

I've been programming with VB for 17 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

Attachments
Duplicates.zip (710 views, 1.00 KB)
millsy
millsy
Forum God
Forum God (620 reputation)Forum God (620 reputation)Forum God (620 reputation)Forum God (620 reputation)Forum God (620 reputation)Forum God (620 reputation)Forum God (620 reputation)Forum God (620 reputation)Forum God (620 reputation)

Group: Forum Members
Posts: 2, Visits: 8
Thanks Keith - all sorted now.

Next challange - trying to create form to search workbook and add information into specific column.  Any suggestions?

Thanks again for your help.

Smile

yavid
yavid
Forum God
Forum God (1K reputation)Forum God (1K reputation)Forum God (1K reputation)Forum God (1K reputation)Forum God (1K reputation)Forum God (1K reputation)Forum God (1K reputation)Forum God (1K reputation)Forum God (1K reputation)

Group: Forum Members
Posts: 3, Visits: 1
I too need help.



Gilli



_________________________

BodogLife hard money lender

koolsid
koolsid
Forum God
Forum God (1.2K reputation)Forum God (1.2K reputation)Forum God (1.2K reputation)Forum God (1.2K reputation)Forum God (1.2K reputation)Forum God (1.2K reputation)Forum God (1.2K reputation)Forum God (1.2K reputation)Forum God (1.2K reputation)

Group: Forum Members
Posts: 4, Visits: 3
yavid (10/7/2008)
I too need help.

Gilli

_________________________
BodogLife hard money lender

What Help?

GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search