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,244
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,244
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Sure. Thank you for your help.
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

Watch MrExcel Video

Forum statistics

Threads
1,130,246
Messages
5,641,083
Members
417,193
Latest member
J00490

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