title: VBA IF/THEN Find & Replace
body: <p>I wanted to ask for some help on how to incorporate an if-then statement in my vba code that find's and replaces certain text.</p>
  
  <p>My situation has several sets of numbers: 8815, 0815, 1234 &amp; 5678 and my current code finds "815" and replaces it with '0815 so that the leading zero isn't lost. Ovbiously my issue is the replace statement it executing correctly on the 0815 set of numbers and is executing on the 8815 set of numbers.</p>
  
  <p>How can I write a command to say, if 8815 then 8815 but not to change the number if "815" isn't in the number?</p>
  
  <pre><code> Columns("H").Replace What:="815", Replacement:="'0815", SearchOrder:=xlByColumns
  </code></pre>
  
  <p>I appreciate any help with this as, I've been looking around for a few hours and haven't found too much on this.</p>