Combobox with textbox and Commandbutton

  • Thread starter Thread starter Stift
  • Start date Start date
S

Stift

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
 
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
 
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 ??
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top