954,558 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Looping 2 IF..Then..Else statements

I am just learning how to write macros and I need some help linking two If..then:..else statements.

I have two drop down boxes that I want to link together. I am trying to tell it that

if one statement is true then filter row
else filter for criteria cell (2, 4)

if one statement is true then filter row
else filter for criteria cell (3, 4)

But I don't know how to link them. I want both drop down boxes to loop together.

Thanks

gdlgplic
Newbie Poster
5 posts since Sep 2006
Reputation Points: 10
Solved Threads: 0
 

I'm not 100% sure I know what you are asking.... if I'm missing the mark completely, let me know.... are you looking for an "elseif" type command?

Comatose
Taboo Programmer
Team Colleague
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
 

Yeah I tried using that but it wasn't working. I ended up figuring it out but thanks for the help. I am teaching myself and trying to learn from picking apart my old teachers macros. But I am missing basic knowledge. I'm sure you will hear from me again soon and thanks for your help.

gdlgplic
Newbie Poster
5 posts since Sep 2006
Reputation Points: 10
Solved Threads: 0
 

Can you tell us what the solution was?

Comatose
Taboo Programmer
Team Colleague
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
 

Sure I don't care:

If Cells(2, 4) = "(ALL)" Then
           If Cells(3, 4) = "(ALL)" Then
            Selection.AutoFilter Field:=3
            Application.Run "HIDE_ROWS"
            Else
            Selection.AutoFilter Field:=3, Criteria1:=Cells(3, 4)
            End If
                       
    Else
        Selection.AutoFilter Field:=2, Criteria1:=Cells(2, 4)
        
            If Cells(3, 4) = "(ALL)" Then
            Selection.AutoFilter Field:=3
            Else
            Selection.AutoFilter Field:=3, Criteria1:=Cells(3, 4)
            End If
            
        
        End If
gdlgplic
Newbie Poster
5 posts since Sep 2006
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You