User Tools

Site Tools


microsoft_excel:macros:colors:change_color

Microsoft Excel - Macros - Colors - Change Color

Navigate to View → Macros → Create Macro.

Sub ChangeColour()
 Dim rCell As Range
  If Selection.Cells.Count = 1 Then
      MsgBox "Select the range to be processed."
      Exit Sub
  End If
  For Each rCell In Selection
      If rCell.Interior.Color = RGB(255, 192, 0) Then  'orange
          rCell.Interior.Color = RGB(128, 100, 162)      'purple
       ElseIf rCell.Interior.Color = RGB(226, 239, 218) Then  'green
          rCell.Interior.Color = RGB(253, 233, 217)      'pink
       ElseIf  rCell.Interior.Color = RGB(214, 220, 228) Then  'grey
          rCell.Interior.Color = RGB(197, 217, 241)      'blue
      End If
  Next rCell
End Sub

Once Macro is created, select range of cells and then run Macro.

microsoft_excel/macros/colors/change_color.txt · Last modified: 2021/08/04 14:36 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki