Help with Drop-down control

S

Scott King

I need to remove cell data while inserting formulas in other cells upon a
selection in a drop-down control. Can someone point me an example or suggest
changes to what I have? I can't seem to find an example in VB or Excel help.

Thanks,

Scott

Private Sub ComboBox1_Change()
With Worksheets(1).Shapes.AddFormControl(xlDropDown, _
Left:=10, Top:=10, Width:=100, Height:=10)
.ControlFormat.DropDownLines = 10
If ComboBox1_Change() = False Then
Range("G42").Select
ActiveCell.FormulaR1C1 = ""
Range("G43").Select
ActiveCell.FormulaR1C1 = "=R[-1]C/(SQRT(3)*RC[-4])"
Range("H42").Select
ActiveCell.FormulaR1C1 = ""
Range("H43").Select
ActiveCell.FormulaR1C1 = "=R[-1]C/(SQRT(3)*RC[-5])"
Range("I42").Select
ActiveCell.FormulaR1C1 = ""
Range("I43").Select
ActiveCell.FormulaR1C1 = "=R[-1]C/(SQRT(3)*RC[-6])"
Range("J42").Select
ActiveCell.FormulaR1C1 = ""
Range("J43").Select
ActiveCell.FormulaR1C1 = "=R[-1]C/(SQRT(3)*RC[-7])"
Range("J44").Select

Else
Range("G43").Select
ActiveCell.FormulaR1C1 = ""
Range("G42").Select
ActiveCell.FormulaR1C1 = "=SQRT(3)*R[1]C[-4]*R[1]C"
Range("H43").Select
ActiveCell.FormulaR1C1 = ""
Range("H42").Select
ActiveCell.FormulaR1C1 = "=SQRT(3)*R[1]C[-5]*R[1]C"
Range("I43").Select
ActiveCell.FormulaR1C1 = ""
Range("I42").Select
ActiveCell.FormulaR1C1 = "=SQRT(3)*R[1]C[-6]*R[1]C"
Range("J43").Select
ActiveCell.FormulaR1C1 = ""
Range("J42").Select
ActiveCell.FormulaR1C1 = "=SQRT(3)*R[1]C[-7]*R[1]C"
End If

End With
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
End Sub
 

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

Top