- Aug 14, 2018
- Office Version
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?
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