Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting Combo boxes to change options based on other Combo boxes. Ancient Wolf New Users to Excel 1 March 27th 09 06:29 PM
NEED URGENT HELP WITH COMBO BOX!!!! gem Excel Discussion (Misc queries) 1 June 13th 06 08:52 PM
Selecting subsets using combo boxes or list boxes CLamar Excel Discussion (Misc queries) 0 June 1st 06 07:43 PM
Questions on combo boxes and list boxes. Marc New Users to Excel 1 March 14th 06 09:40 AM
Need help with combo boxes on Spreadsheet Wayne Morris Excel Programming 0 September 18th 03 04:31 PM


All times are GMT +1. The time now is 08:38 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"