Your problem is that you are trying to nest the if statements without an ELSE statement in the if when what you want is a simple set of if statements.
If you step through the code and ask youself what happens when the first if statement fails you will find that the code will pass to the end if which relates to the first if which is the last end if in the code.
The rwo possible correct constructs for your code are
-
-
If Range("G13") = 1 Then
-
Sheets("Price Sheet").Select
-
Range("B10") = "Master"
-
Range("D10") = "M"
-
End If
-
-
If Range("H13") = 1 Then
-
Sheets("Price Sheet").Select
-
Range("B11") = "Slave"
-
Range("D11") = "M"
-
end if
-
-
If Range("I13") = 1 Then
-
Sheets("Price Sheet").Select
-
Range("B12") = "Outlet"
-
Range("D12") = "M"
-
end if
-
-
This construct is valid if you are testing for each range independantly and it is OK if more than one range is valid.
-
-
If Range("G13") = 1 Then
-
Sheets("Price Sheet").Select
-
Range("B10") = "Master"
-
Range("D10") = "M"
-
else
-
If Range("H13") = 1 Then
-
Sheets("Price Sheet").Select
-
Range("B11") = "Slave"
-
Range("D11") = "M"
-
else
-
If Range("I13") = 1 Then
-
Sheets("Price Sheet").Select
-
Range("B12") = "Outlet"
-
Range("D12") = "M"
-
end if
-
end if
-
end if
-
This construct only allows for one range to be true. If more than one range is true then the code will only execute for the first true range.
Also note the indenting convention used in the code. This ensures that each IF THEN ELSE line that belongs together is lined up at the same indent level and that each block of code that executes is clearly associated with the if or else clause that causes it to execute.
This makes it easier to see to logic in the code and ensure that each of your multi line if statements has corresponding ELSE and END IF lines associated with it.