Sub RowColor_26()
' -------------------------------------------------------------------------------------------------------------------------------------
' This will color rows in groups based on data the matched in a certain column
' by Zenwood 6.13.18
' Users are asked to update variables
' -------------------------------------------------------------------------------------------------------------------------------------
' Compare items in this column
Dim Compare As String
Compare = InputBox(vbCr & " What column are we sorting on?" & vbCr & vbCr & " Press Return for default values", , "A")
' Find the end of this column
Dim HomeColumn As String
HomeColumn = InputBox(vbCr & " Look to the end of what column?", , "A")
' Start with this row
Dim Row As Integer: Row = 2
Row = InputBox(vbCr & " What row to start with?", , "2")
' Color across from this column
Dim ColumnStart As String
ColumnStart = InputBox(vbCr & " Start column?", , "A")
' Stop coloring across at this column
Dim ColumnEnd As String
ColumnEnd = InputBox(vbCr & " End column?", , "R")
' -------------------------------------------------------------------------------------------------------------------------------------
' Start with this much Red
Dim Red As Integer
Red = InputBox(vbCr & " How much Red?" & vbCr & vbCr & " 200 - 255", , "210")
' Start with this much Green
Dim Green As Integer
Green = InputBox(vbCr & " How much Green?" & vbCr & vbCr & " 200 - 255", , "250")
' Start with this much Blue
Dim Blue As Integer
Blue = InputBox(vbCr & " How much Blue?" & vbCr & vbCr & " 200 - 255", , "210")
' -------------------------------------------------------------------------------------------------------------------------------------
' Change Red by... not zero
Dim NewRed As Integer
NewRed = InputBox(vbCr & " How much Red to add?" & vbCr & vbCr & " +/- 50", , "1")
If NewRed = 0 Then NewRed = 1
' Change Green by...
Dim NewGreen As Integer
NewGreen = InputBox(vbCr & " How much Green to add?" & vbCr & vbCr & " +/- 50", , "0")
' Change Blue by...
Dim NewBlue As Integer
NewBlue = InputBox(vbCr & " How much Blue to add?" & vbCr & vbCr & " +/- 50", , "40")
Dim BaseRed As Integer: BaseRed = Red
' -------------------------------------------------------------------------------------------------------------------------------------
Do While (Cells(Row, HomeColumn) <> "")
If (Cells(Row, Compare) <> "") And (Cells(Row - 1, Compare) = Cells(Row, Compare)) Then
Red = Red
Else
If Red = BaseRed Then
Red = Red + NewRed
Green = Green + NewGreen
Blue = Blue + NewBlue
Else
Red = Red - NewRed
Green = Green - NewGreen
Blue = Blue - NewBlue
End If
End If
Range(ColumnStart & Row, ColumnEnd & Row).Interior.Color = RGB(Red, Green, Blue)
Row = Row + 1
Loop
' -------------------------------------------------------------------------------------------------------------------------------------
End Sub