ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Combo Box (https://www.excelbanter.com/excel-programming/323592-combo-box.html)

Aksel Børve

Combo Box
 
I am trying to copy values from a range, into an cell on another sheet,
depending of the vaue of the combo box.
but nothing happens when I change the value in the combo box
Any suggestions?
Thanks!

Private Sub ComboBoxScr_Change()

Sheets("Kick Info").Unprotect password:="driller"
Application.ScreenUpdating = False
Sheets("Volume").Select
ActiveSheet.Range("H29").Select
'If this value is 1, the mud Pump A is the Active
If ActiveCell.FormulaR1C1 = "1" Then GoTo Line1 Else GoTo Line10
Line1:
If ComboBoxScr.Value = "20" Then GoTo Line2 Else GoTo Line3
Line2:
Worksheets("Volume").Select
Range("F40").Copy
ActiveSheet.Paste Destination:=Worksheets("Kick Info").Range("B15")
GoTo Lastline
Line3:
If ComboBoxScr.Value = "25" Then GoTo Line4 Else GoTo Line5
Line4:
Worksheets("Volume").Select
Range("F41").Copy
ActiveSheet.Paste Destination:=Worksheets("Kick Info").Range("B15")
GoTo Lastline
Line5:
If ComboBoxScr.Value = "30" Then GoTo Line6 Else GoTo Line7
Line6:
Worksheets("Volume").Select
Range("F42").Copy
ActiveSheet.Paste Destination:=Worksheets("Kick Info").Range("B15")
GoTo Lastline:
Line7:
If ComboBoxScr.Value = "35" Then GoTo Line8 Else GoTo Line9
Line8:
Worksheets("Volume").Select
Range("F43").Copy
ActiveSheet.Paste Destination:=Worksheets("Kick Info").Range("B15")
GoTo Lastline:
Line9:
If ComboBoxScr.Value = "40" Then
Worksheets("Volume").Select
Range("F44").Copy
ActiveSheet.Paste Destination:=Worksheets("Kick Info").Range("B15")
End If
GoTo Lastline
Line10:
Sheets("Volume").Select
ActiveSheet.Range("H29").Select
'If this value is 1, the mud Pump B is the Active
If ActiveCell.FormulaR1C1 = "2" Then GoTo Line11 Else GoTo Line20

Line11:
Line20:
'Same as above just with mud pump B, "not finish"

Lastline:

End Sub



Tonhao

Combo Box
 
Remoe quotation marks !!!

If ActiveCell.FormulaR1C1 = "1"Line1:
# If ActiveCell.Value = 1

If ComboBoxScr.Value = "20"
# If ComboBoxScr.Value = 20

I am trying to copy values from a range, into an cell on another sheet,
depending of the vaue of the combo box.
but nothing happens when I change the value in the combo box
Any suggestions?
Thanks!

Private Sub ComboBoxScr_Change()

Sheets("Kick Info").Unprotect password:="driller"
Application.ScreenUpdating = False
Sheets("Volume").Select
ActiveSheet.Range("H29").Select
'If this value is 1, the mud Pump A is the Active
If ActiveCell.FormulaR1C1 = "1" Then GoTo Line1 Else GoTo Line10
Line1:
If ComboBoxScr.Value = "20" Then GoTo Line2 Else GoTo Line3
Line2:
Worksheets("Volume").Select
Range("F40").Copy
ActiveSheet.Paste Destination:=Worksheets("Kick Info").Range("B15")
GoTo Lastline
Line3:
If ComboBoxScr.Value = "25" Then GoTo Line4 Else GoTo Line5
Line4:
Worksheets("Volume").Select
Range("F41").Copy
ActiveSheet.Paste Destination:=Worksheets("Kick Info").Range("B15")
GoTo Lastline
Line5:
If ComboBoxScr.Value = "30" Then GoTo Line6 Else GoTo Line7
Line6:
Worksheets("Volume").Select
Range("F42").Copy
ActiveSheet.Paste Destination:=Worksheets("Kick Info").Range("B15")
GoTo Lastline:
Line7:
If ComboBoxScr.Value = "35" Then GoTo Line8 Else GoTo Line9
Line8:
Worksheets("Volume").Select
Range("F43").Copy
ActiveSheet.Paste Destination:=Worksheets("Kick Info").Range("B15")
GoTo Lastline:
Line9:
If ComboBoxScr.Value = "40" Then
Worksheets("Volume").Select
Range("F44").Copy
ActiveSheet.Paste Destination:=Worksheets("Kick Info").Range("B15")
End If
GoTo Lastline
Line10:
Sheets("Volume").Select
ActiveSheet.Range("H29").Select
'If this value is 1, the mud Pump B is the Active
If ActiveCell.FormulaR1C1 = "2" Then GoTo Line11 Else GoTo Line20

Line11:
Line20:
'Same as above just with mud pump B, "not finish"

Lastline:

End Sub





All times are GMT +1. The time now is 02:15 AM.

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