ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   IF-statement?? (https://www.excelbanter.com/excel-programming/299258-if-statement.html)

Stift[_12_]

IF-statement??
 
I've got a Combobox1 in a userform which contains the values of
C9:C63.
My Combobox2 says the numbers of the week.
I've also got a text form.

Now I want that if the user select a column in Combobox1 and select
weeknummer in Combobox2, and type a value in the textbox and press d
CommandButton.The content of the textbox must be fill in in the righ
cell.

Everything seems to work but only the if statement i don't know wha
do to:

What must I type in the source of the CommandButton???

Something like this :

If ComboBox2.RowSource = "Week 1" Then
Set Cel = Cells(9 + ComboBox1.ListIndex, 17)
Cel.Value = _
Me.TextBox1.Text
End If

If ComboBox2.RowSource = "Week 2" Then
Set Cel = Cells(10 + ComboBox1.ListIndex, 17)
Cel.Value = _
Me.TextBox1.Text
End If

But then it's now quite working.

Please Heeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeelllp me !!

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

IF-statement??
 
How about,

Set Cel = Range(ComboBox1.ListIndex,
17).Offset(Mid(Combobox2).Value,6,2+8,17)
Cel.Value = Me.TextBox1.Text

Not really surely where you put the values, but hopefully that gets you
started.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Stift " wrote in message
...
I've got a Combobox1 in a userform which contains the values of
C9:C63.
My Combobox2 says the numbers of the week.
I've also got a text form.

Now I want that if the user select a column in Combobox1 and select a
weeknummer in Combobox2, and type a value in the textbox and press de
CommandButton.The content of the textbox must be fill in in the right
cell.

Everything seems to work but only the if statement i don't know what
do to:

What must I type in the source of the CommandButton???

Something like this :

If ComboBox2.RowSource = "Week 1" Then
Set Cel = Cells(9 + ComboBox1.ListIndex, 17)
Cel.Value = _
Me.TextBox1.Text
End If

If ComboBox2.RowSource = "Week 2" Then
Set Cel = Cells(10 + ComboBox1.ListIndex, 17)
Cel.Value = _
Me.TextBox1.Text
End If

But then it's now quite working.

Please Heeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeelllp me !!!


---
Message posted from http://www.ExcelForum.com/




Stift[_13_]

IF-statement??
 
Fixed the problem,thanks for your help!


---
Message posted from http://www.ExcelForum.com/



All times are GMT +1. The time now is 07:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com