Advertisement
YasserKhalil2019

T3954_Convert Formulas To VBA Code

Sep 24th, 2019
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. https://excel-egy.com/forum/t3954
  2. ---------------------------------
  3.  
  4. Sub Convert_Formulas_To_VBA_Code()
  5. Dim lr As Long
  6.  
  7. Application.ScreenUpdating = False
  8. With ActiveSheet
  9. .Range("A6").Formula = "=IF(C6+D6>0,C6,0)"
  10. .Range("A6").Offset(, 1).Formula = "=IF(C6+D6<0,D6,0)"
  11.  
  12. lr = .Cells(Rows.Count, "H").End(xlUp).Row
  13. .Range("A7:A" & lr).Formula = "=IF(G7<>"""",IF(C7+D7+A6+B6>0,C7+D7+A6+B6,0),0)"
  14. .Range("B7:B" & lr).Formula = "=IF(G7<>"""",IF(C7+D7+A6+B6<0,C7+D7+A6+B6,0),0)"
  15.  
  16. .Range("A6:B" & lr).Value = .Range("A6:B" & lr).Value
  17. End With
  18. Application.ScreenUpdating = True
  19. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement