ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Clear cell data using Combo Box (https://www.excelbanter.com/excel-programming/393654-clear-cell-data-using-combo-box.html)

Scott King[_2_]

Clear cell data using Combo Box
 
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


Scott King[_2_]

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



All times are GMT +1. The time now is 04:48 PM.

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