Loop Conditional Formatting - VBA

CJG19

New Member
Joined
Jul 12, 2021
Messages
40
Office Version
  1. 2010
Platform
  1. Windows
Good Morning All,

I am trying to set up a loop conditional formatting with a pop up message, but something isn't working, can anyone help please?

1638779906282.png


If BO equals 0, BK is greater than 0 and BL says No then I want the cell in BL to turn red and a pop up massage to question 'Have we received final account certificate?' Once turned to yes it carries on to the next cell continues to the bottom of the table then goes back to the beginning. I have the following and I am unsure where I am going wrong:

Sub Final_Account_Cert()

'Remove cell fill colour
With Range("BK5:B100").Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Range("BL5").Select
'Begin the loop
Do Until ActiveCell.Value = ""
If ActiveCell.Value = No And ActiveCell.Offset(0, -1) > 0 And ActiveCell.Offset(0, 3) = 0 Then
'Display a message to the user
MsgBox "Have We Received Final Account Certificate?", vbInformation, "Invoice Detail"
'Format Invoice Code Cell to Red
ActiveCell.Interior.Color = 255
End If
ActiveCell.Offset(1, 0).Select
Loop

End Sub

I would appreciate any help!

TIA!

CJG19 :)
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Put below code in workheet_selectionchange even of "sheet" (not in module) to fire the range BL5:BL100 selection

VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Not Intersect(Target, Range("BL5:BL100")) Is Nothing Then
        If Target.Offset(, -1) > 0 And Target = "No" And Target.Offset(, 3) = 0 Then
        MsgBox "Have We Received Final Account Certificate?", vbInformation, "Invoice Detail"
        Target.Interior.Color = 255
        End If
    End If
End Sub
 
Upvote 0
It doesn't seem to work:

1638794627652.png


1638794678926.png


Have I done something wrong?
 
Upvote 0

Forum statistics

Threads
1,214,518
Messages
6,119,985
Members
448,935
Latest member
ijat

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