Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Could anyone helping me with this?
After deleting column A & B, adding 2 column G and H and enter text in G2 and H2, Id 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() -- Thanks, Aline |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Formula - Macro | Excel Discussion (Misc queries) | |||
Is there a Formula or Macro for This? | Excel Discussion (Misc queries) | |||
set formula by Macro | Excel Worksheet Functions | |||
Help with macro or formula | Excel Discussion (Misc queries) | |||
Add formula to Macro??? | New Users to Excel |