Forum Discussion

FatManFluff's avatar
FatManFluff
Brass Contributor
Nov 09, 2024
Solved

VBA to add IF Statement

Good morning all, Having a hard time getting VBA to set a formula into a cell when I use the reset button to delete all contents. Currently I am using:   Sub AddFormula() Range("P4").Value = "IF(...
  • HansVogelaar's avatar
    Nov 09, 2024

    Try this:

    Sub AddFormula()
        Range("P4").Formula= "=IF(D4<>"""",D4,"""")"
    End Sub

     

Resources