Good Day All
I've only recently (a couple weeks) started to slowly teach myself VBA via an online step by step guide I've found, and now I'm trying to write my first bit of code from scratch. I'm trying to make an "IF" code, and it keeps giving me an the response to the "ELSE" part of the code, despite the condition being true. So where am I going wrong with this?
Set up:
Cell K5 = 15,000,000
Cell K7 = 12,500,000
Cell K8 = (K7/K5)-1
Cell K8 Result = -16.7%
Code:
Option Explicit
Sub Company_Wide_Sales_Growth()
'Trying to make cell K11 show -37.12% if Cell K8 is between -16.1% and -18%
Dim change As Integer
Dim modifier As Integer
change = Cells(8, "K")
If change < -0.161 And change > -0.18 Then
modifier = -0.3712
Cells(11, "K").Value = modifier
Else
Cells(11, "K").Value = "Why Aren't You Doing What I Want?!"
End If
End Sub
Thanks for your help!
Bookmarks