User Tools

Site Tools


microsoft_excel:macros:change_color

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

microsoft_excel:macros:change_color [2021/08/04 14:01] – created petermicrosoft_excel:macros:change_color [2021/08/04 14:36] (current) – removed peter
Line 1: Line 1:
-====== Microsoft Excel - Macros - Change Color ====== 
  
-Navigate to **View -> Macros -> Create Macro**. 
- 
-<code> 
-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 
-</code> 
- 
-Once Macro is created, select range of cells and then run Macro. 
microsoft_excel/macros/change_color.1628085672.txt.gz · Last modified: 2021/08/04 14:01 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki