![]() |
Combobox with textbox and Commandbutton
Hi
I've created a userform with VBA where the user can select a value from a Combobox.The rowsource is :Database!C9:C63. Now I want that the user can select a value from this Combobox, then fill in something in the textbox. When the user press Commandbutton the value typed in the textbox mus me put in the cell linked to the cell from the combobox but a fe colums further(Q9:Q63). The colums Q7 till BQ7 are filled with the numbers 1 till 5 representing the numbers of the week.In the userform I want a textbo where the user can fill in the weeknumber and then going to add value in that column with the Combobox, textbox and Commandbutton describe above. I know it's very hard to make this possible, otherwise I wouldn't hav bothered you with this, But I hope you'll help me!!! A lot of Thanks In Advance. R.Stif -- Message posted from http://www.ExcelForum.com |
Combobox with textbox and Commandbutton
Hi R
If I understand your needs then see if this get you started: Private Sub CommandButton1_Click() On Error Resume Next Dim Cel As Range ' the Q cell: Set Cel = Cells(9 + ComboBox1.ListIndex, 17) MsgBox Cel.Address 'the weeknumber column: Set Cel = Cells(9 + ComboBox1.ListIndex, 16 + Val(TextBox1.Text)) MsgBox Cel.Address End Sub HTH. Best wishes Harald "Stift " skrev i melding ... Hi I've created a userform with VBA where the user can select a value from a Combobox.The rowsource is :Database!C9:C63. Now I want that the user can select a value from this Combobox, then fill in something in the textbox. When the user press Commandbutton the value typed in the textbox must me put in the cell linked to the cell from the combobox but a few colums further(Q9:Q63). The colums Q7 till BQ7 are filled with the numbers 1 till 53 representing the numbers of the week.In the userform I want a textbox where the user can fill in the weeknumber and then going to add values in that column with the Combobox, textbox and Commandbutton described above. I know it's very hard to make this possible, otherwise I wouldn't have bothered you with this, But I hope you'll help me!!! A lot of Thanks In Advance. R.Stift --- Message posted from http://www.ExcelForum.com/ |
Combobox with textbox and Commandbutton
Hi Harald, It's not quite what I mean,but there's something good in it.
Now when I choose from my Combobox and then add text in my textbox an then press my commandbutton it will give a popup with the right cell. When I select first option from my combo it returns(Q9) When I select 2nd option from my combo it returns(Q10) But I don't want a popup,but I want the text entered in my textbo filled in that cell My combobox with the cells where the weeknumbers are found(Q7:BQ7 isn't working yet. Someone can help me further ?? -- Message posted from http://www.ExcelForum.com |
Combobox with textbox and Commandbutton
Ok adjusted your code a bit now It's almost good:
Private Sub CommandButton1_Click() On Error Resume Next Dim Cel As Range ' the Q cell: Set Cel = Cells(9 + ComboBox1.ListIndex, 17) Cel.Value = _ Me.TextBox1.Text Now Only the weekboxproblem must be fixt cuz now it will only fill week 1(column Q -- Message posted from http://www.ExcelForum.com |
Combobox with textbox and Commandbutton
"Stift " skrev i melding
... Ok adjusted your code a bit now It's almost good: I really appreciate your improvements <bg Best wishes Harald |
All times are GMT +1. The time now is 12:37 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com