brooklyn2007
Board Regular
- Joined
- Nov 20, 2010
- Messages
- 143
Hello, I'm all new with this VBA and I'm trying to learn by myself. I have a very simple problem for a VBA expert. I need to use an IF, Else Statement but still is very hard for me. In my problem I need to put all my data in the cells in the code that I'm displaying below. If A2is equal to zero, display all the data in B1 and B2, otherwise do't display anything in B1 and B2
Sub Jim()
Range("c6").Value = "John"
Range("d6").Value = "Kenny"
Range("g2").Value = "Total"
Range("H8").Value = "Multiplication"
Range("i8").Value = "=c7*d7"
If Range("a2").Value = "" Then Range("b2").Value = "=i8-h2"
Range("b1").Value = "Difference"
End Sub
How do I use otherwise or Else in my code? Thx
Sub Jim()
Range("c6").Value = "John"
Range("d6").Value = "Kenny"
Range("g2").Value = "Total"
Range("H8").Value = "Multiplication"
Range("i8").Value = "=c7*d7"
If Range("a2").Value = "" Then Range("b2").Value = "=i8-h2"
Range("b1").Value = "Difference"
End Sub
How do I use otherwise or Else in my code? Thx