Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Urgent!! Combo boxes 2 spreadsheet?? Thx
Hi
Is it possible in a userform, to have a combo box with data (lets say different years, 2003,2004 to 2008) and after the user presses a button on that, for it to takes the user to a worksheet and puts a word in the appropriate cell (e.g. Yes). So.........there's a column of years and then, depending on what year the user selected, the word Yes is entered alongside the year. How do I get this to work? Shud I use option buttons/check boxes instead?? Thx for any replies Chris --- Message posted from http://www.ExcelForum.com/ |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Urgent!! Combo boxes 2 spreadsheet?? Thx
A combobox seems ok to me--although if you wanted the user to select multiple
years, you may want to use a listbox. I made a userform with a combobox on it and one command button. This is the code I used behind the userform: Option Explicit Private Sub CommandButton1_Click() Dim res As Variant Dim myYear As Long If Me.ComboBox1.ListIndex = -1 Then Exit Sub End If myYear = CLng(Me.ComboBox1.Value) With Worksheets("sheet1") res = Application.Match(myYear, .Range("a:a"), 0) If IsError(res) Then MsgBox myYear & " wasn't found on the worksheet" Else .Range("a:a")(res).Offset(0, 1).Value = "yes" MsgBox "Updated row#: " & res End If End With Me.ComboBox1.ListIndex = -1 'reset it? End Sub 'some test data?? Private Sub UserForm_Initialize() Dim iCtr As Long For iCtr = 2003 To 2008 Me.ComboBox1.AddItem iCtr Next iCtr End Sub KrisB_bacon wrote: Hi Is it possible in a userform, to have a combo box with data (lets say different years, 2003,2004 to 2008) and after the user presses a button on that, for it to takes the user to a worksheet and puts a word in the appropriate cell (e.g. Yes). So.........there's a column of years and then, depending on what year the user selected, the word Yes is entered alongside the year. How do I get this to work? Shud I use option buttons/check boxes instead?? Thx for any replies Chris --- Message posted from http://www.ExcelForum.com/ -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Getting Combo boxes to change options based on other Combo boxes. | New Users to Excel | |||
NEED URGENT HELP WITH COMBO BOX!!!! | Excel Discussion (Misc queries) | |||
Selecting subsets using combo boxes or list boxes | Excel Discussion (Misc queries) | |||
Questions on combo boxes and list boxes. | New Users to Excel | |||
Need help with combo boxes on Spreadsheet | Excel Programming |