title: Excel VBA: How to create macro to change text color using if statement
body: <p>This is a continuation for the following question: <a href="https://stackoverflow.com/questions/46947216/what-is-the-cause-for-conditional-formatting-to-get-jumbled-up">What is the cause for Conditional Formatting to get jumbled up?</a></p>
  
  <p>In an attempt to prevent my conditional formatting from going haywire, I decided to convert it into code in VBA. I decided to start small and start with converting one conditional formatting into VBA.</p>
  
  <p>Explanation:</p>
  
  <p>In column O there are a series of numbers, obtained from a different sheet. User inputs number in column F. For example if number in F9 is less than O9, the font colour will become red. If not number remains normal. The formula should start at row 9 and can continue down onwards and should be automatic.
  Meaning the moment a number is keyed in column F the font colour should change instantly.</p>
  
  <p>The following is the code I created so far:</p>
  
  <pre><code>Sub change_color()
  
  With Me.Range("f9", Range("f" &amp; Rows.Count).End(xlUp)) 'so the formula will carry onwards from f9 onwards
      If f9 &lt; o9 Then
          Range(f).Font.Color = vbRed
      End If
  End With
  
  End Sub
  </code></pre>
  
  <p>But alas it didn't work. I also tried linking it to a button and nothing happens. And I also remember to remove my old conditional formatting as well. Is there something I'm missing?</p>