SELECT CASE: Case Is a Value or Blank

madkinson

Board Regular
Joined
Dec 17, 2004
Messages
113
Office Version
  1. 365
Platform
  1. Windows
I have a portion of a SELECT Case statement that I want to fire based on whether there is a value in the cell or whether it is blank (see HIGHLIGHTED):

Code:
Select Case Range("T" & ActiveCell.Row) ' Action
                Case "Removed"
                   [B] [U]Select Case Range("R" & ActiveCell.Row) ' Rule or blank[/U][/B]
                        Case " "
                            Select Case Range("D" & ActiveCell.Row) ' Control Flag
                                Case "Yes"
                                    Select Case Range("U" & ActiveCell.Row) ' Permanent
                                        Case "Yes"
                                            ActiveCell.Value = "Permanently removed the Control Flag from account " & Range("J" & ActiveCell.Row) & "." & Chr(10) & "Removed " & Range("V" & ActiveCell.Row) & "."
                                        Case Else
                                            ActiveCell.Value = "Removed the Control Flag from account " & Range("J" & ActiveCell.Row) & "." & Chr(10) & "Removed " & Range("V" & ActiveCell.Row) & " and restored " & Range("W" & ActiveCell.Row) & "."
                                    End Select
                                Case Else
                                    Select Case Range("U" & ActiveCell.Row) ' Permanent
                                        Case "Yes"
                                            ActiveCell.Value = "Permanently removed account " & Range("J" & ActiveCell.Row) & " on the " & Range("Q" & ActiveCell.Row) & " node of the " & Range("P" & ActiveCell.Row) & " tree." & Chr(10) & "Removed " & Range("V" & ActiveCell.Row) & "."
                                        Case Else
                                            ActiveCell.Value = "Removed account " & Range("J" & ActiveCell.Row) & " from the " & Range("Q" & ActiveCell.Row) & " node of the " & Range("P" & ActiveCell.Row) & " tree." & Chr(10) & "Removed " & Range("V" & ActiveCell.Row) & " and restored " & Range("W" & ActiveCell.Row) & "."
                                    End Select
                            End Select
                        Case Else
                            Select Case Range("U" & ActiveCell.Row) ' Permanent
                                Case "Yes"
                                    ActiveCell.Value = "Permanently removed account " & Range("J" & ActiveCell.Row) & " from the " & Range("R" & ActiveCell.Row) & " rule." & Chr(10) & "Removed " & Range("V" & ActiveCell.Row) & "."
                                Case Else
                                    ActiveCell.Value = "Removed account " & Range("J" & ActiveCell.Row) & " from the " & Range("R" & ActiveCell.Row) & " rule." & Chr(10) & "Removed " & Range("V" & ActiveCell.Row) & " and restored " & Range("W" & ActiveCell.Row) & "."
                            End Select
                    End Select
            End Select

The inside parts work as intended, but I can't get the second Select Case to fire on the first option (where Case = " "). I guessed that it doesn't recognize a " " as a blank, so I tried reversing the logic so the first option was (where Case Like "*"). It didn't like that either, so I really don't know how to proceed from here.

Thanking you in advance,
Mark
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top