A
Aline
Could anyone helping me with this?
After deleting column A & B, adding 2 column G and H and enter text in G2
and H2, I’d like to add a formula G2 (as well as H2). How do I add formula
to a macro?
Formula on G2: =IF(I2="0001", "E?", IF(OR(I2="0002", I2="0003",
I2="0004", I2="0005"), "Y", "N"))
Formula on H2: =IF(A2<>A3,"Row used")
As following is the VBA codes for my macro:
Sub CompFormula()
'
' CompFormula Macro
Columns("H:H").ColumnWidth = 12.14
Columns("A:B").Select
Selection.Delete Shift:=xlToLeft
Columns("G:H").Select
Selection.Insert Shift:=xlToRight
Range("G1").Select
ActiveCell.FormulaR1C1 = "Meet Y/N"
Range("H1").Select
ActiveCell.FormulaR1C1 = "Row used"
Range("G2").Select
End SubSub CompFormula()
After deleting column A & B, adding 2 column G and H and enter text in G2
and H2, I’d like to add a formula G2 (as well as H2). How do I add formula
to a macro?
Formula on G2: =IF(I2="0001", "E?", IF(OR(I2="0002", I2="0003",
I2="0004", I2="0005"), "Y", "N"))
Formula on H2: =IF(A2<>A3,"Row used")
As following is the VBA codes for my macro:
Sub CompFormula()
'
' CompFormula Macro
Columns("H:H").ColumnWidth = 12.14
Columns("A:B").Select
Selection.Delete Shift:=xlToLeft
Columns("G:H").Select
Selection.Insert Shift:=xlToRight
Range("G1").Select
ActiveCell.FormulaR1C1 = "Meet Y/N"
Range("H1").Select
ActiveCell.FormulaR1C1 = "Row used"
Range("G2").Select
End SubSub CompFormula()