View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Scott King[_2_] Scott King[_2_] is offline
external usenet poster
 
Posts: 3
Default Clear cell data using Combo Box

I've got the following working, but is there a way to do this without the
"Range("Cell").Select ? Also, how can I format the font color?

Private Sub ComboBox4_Change()
If ComboBox4 = "Enter kVA" Then
Range("J43").Select
ActiveCell.FormulaR1C1 = "=R[-1]C/(SQRT(3)*RC[-7])"
Range("J42").Select
ActiveCell.FormulaR1C1 = "0"
Range("I43").Select
ActiveCell.FormulaR1C1 = "=R[-1]C/(SQRT(3)*RC[-6])"
Range("I42").Select
ActiveCell.FormulaR1C1 = "0"
Range("H43").Select
ActiveCell.FormulaR1C1 = "=R[-1]C/(SQRT(3)*RC[-5])"
Range("H42").Select
ActiveCell.FormulaR1C1 = "0"
Range("G43").Select
ActiveCell.FormulaR1C1 = "=R[-1]C/(SQRT(3)*RC[-4])"
Range("G42").Select
ActiveCell.FormulaR1C1 = "0"
Else
Range("J42").Select
ActiveCell.FormulaR1C1 = "=SQRT(3)*R[1]C[-7]*R[1]C"
Range("J43").Select
ActiveCell.FormulaR1C1 = "0"
Range("I42").Select
ActiveCell.FormulaR1C1 = "=SQRT(3)*R[1]C[-6]*R[1]C"
Range("I43").Select
ActiveCell.FormulaR1C1 = "0"
Range("H42").Select
ActiveCell.FormulaR1C1 = "=SQRT(3)*R[1]C[-5]*R[1]C"
Range("H43").Select
ActiveCell.FormulaR1C1 = "0"
Range("G42").Select
ActiveCell.FormulaR1C1 = "=SQRT(3)*R[1]C[-4]*R[1]C"
Range("G43").Select
ActiveCell.FormulaR1C1 = "0"
End If
End Sub
Private Sub Worksheet_Activate()
With Me.ComboBox4
.ListFillRange = "M30: M31"
.ListIndex = 0
End With
End Sub

"Scott King" wrote:

I have a combo box with 2 selections. How can I clear data or a formula from
A1 while inserting a formula into A2. Additionaly, using the second
selection, remove data or a formula from A2 while inserting a formula into A1.

Help/Advice/direction greatly appreciated.

Scott