Applying colour change to a row before a yes/no question on whether this is the right row is answered

dpaton05

Well-known Member
Joined
Aug 14, 2018
Messages
2,172
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I have some code that asks if this row is the correct row and I want it somehow made visually different when I ask the question so you know which row the question is relating to. This is the code I have but the row only turns a different colour after the question is asked. How do I get it to change colour or something similar after the question is asked but before it is answered?

VBA Code:
                                Dim rws&: rws = Range("A4:A" & Cells(Rows.Count, 1).End(3).row).SpecialCells(xlCellTypeVisible).Count
                                'if this range is greater than 1, ask the below question, else continue
                                If rws > 1 Then
                                'If ws.Range("A4", ws.Range("A4").End(xlDown)) > 1 Then
                                    Dim Answer As Integer
                                    Dim RowNumber As Long
                                    Dim RowLine As Range
                                    For Each RowLine In rng
                                        RowLine.EntireRow.Interior.ColorIndex = 3
                                        Answer = MsgBox("Is this the job you want to apply the late cancel price too?", vbQuestion + vbYesNo + vbDefaultButton2, "Late Cancel Price")
                                        If Answer = vbYes Then
                                            'I had to include a -3 in here to account for the 3 rows above the data that don't have data in them
                                            RowNumber = RowLine.row - 3
                                            'RowLine.EntireRow.Interior.ColorIndex = 3
                                            GoTo FoundRightJob
                                        End If
                                        'If answer = vbNo
                                       
                                    Next RowLine
                                End If

Thanks
 

dpaton05

Well-known Member
Joined
Aug 14, 2018
Messages
2,172
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Sure. Thank you for your help.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Watch MrExcel Video

Forum statistics

Threads
1,129,387
Messages
5,636,019
Members
416,892
Latest member
Bensch

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
Top