Two selects in one case

BMD

Board Regular
Joined
Oct 5, 2005
Messages
211
If you enter Pass in column G and there is a no in column B then just run the message box.

Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim WatchRange As Range
Dim WatchRangeI As Range
Dim WatchRangeB As Range
Dim cell As Range
Dim rng As Range
Dim myMultiAreaRange As Range

Set WatchRange = Sh.Columns("G")
Set WatchRangeI = Sh.Columns("I")
Set WatchRangeB = Sh.Columns("B")

Set myMultiAreaRange = Union(WatchRange, WatchRangeI, WatchRangeB)

If Intersect(Target, myMultiAreaRange) Is Nothing Then Exit Sub
    
Set rng = Intersect(Target, myMultiAreaRange)

For Each cell In rng

    With Sh.Range(Sh.Cells(cell.Row, "A"), Sh.Cells(cell.Row, "O")).Font
        Select Case LCase(cell):
            Case "Pass", "P"
                Select Case Sh.Cells(cell.Row, "I")
                    Case "Major", "Minor", "Maj", "Min"
                        .ColorIndex = 5
                        .Bold = True
                        
                        
                Select Case Sh.Cells(cell.Row, "B")
                    Case "No"
                        MsgBox "This Testcase Is Not Included....Please Set Cloumn B To 'Yes' To Include This Testcase"
                End Select
                        
                        
                    Case Else
                        .ColorIndex = 10
                        .Bold = False
                End Select
            Case "Major", "Maj", "Minor", "Min"
                Select Case Sh.Cells(cell.Row, "G")
                    Case "Pass", "P"
                        .ColorIndex = 5
                        .Bold = True
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
I think I got it I move the select out side.

If Intersect(Target, myMultiAreaRange) Is Nothing Then Exit Sub

Set rng = Intersect(Target, myMultiAreaRange)

For Each cell In rng

Select Case Sh.Cells(cell.Row, "B")
Case "No"
MsgBox "This Testcase Is Not Included....Please Set Cloumn B To 'Yes' To Include This Testcase"
End Select


With Sh.Range(Sh.Cells(cell.Row, "A"), Sh.Cells(cell.Row, "O")).Font
Select Case LCase(cell):
Case "Pass", "P"
Select Case Sh.Cells(cell.Row, "I")
Case "Major", "Minor", "Maj", "Min"
.ColorIndex = 5
.Bold = True
Case Else
.ColorIndex = 10
.Bold = False
End Select

THANKS,
Bruce.
 
Upvote 0

Forum statistics

Threads
1,214,636
Messages
6,120,666
Members
448,977
Latest member
moonlight6

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