Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I am trying to use an "If" statement that also contains "And". Below is an
example of what I am trying to do: Sub test() If Sheets("Sheet 1").Range("A1").Value = "1" And _ Sheets("Sheet 1").Range("A2").Value = "Yes" Then Sheets("Sheet 2").Select ElseIf Sheets("Sheet 1").Range("A1").Value = "1" And _ Sheets("Sheet 1").Range("A2").Value = "No" Then Sheets("Sheet 2").Select Rows("1:2").Select Selection.Delete Shift:=x1Up End If End Sub Basically, if cell A1 says "1" I want it to select Sheet 2. And if cell A2 says Yes, I want it to leave Sheet 2 as is. If cell A2 says No, I want it to delete a couple of lines in Sheet 2. Can anyone please give me any pointers about what I am doing wrong. Thanks heaps in advance! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
if then else statement also using "and" | Excel Discussion (Misc queries) | |||
The "IF" Statement | Excel Worksheet Functions | |||
If statement | Excel Discussion (Misc queries) | |||
Do I need a sumif or sum of a vlookup formula? | Excel Worksheet Functions | |||
How do I fix a circular reference in a financial statement? | Excel Discussion (Misc queries) |