I have a macro set up to add a specific number for each fill color of a cell, the problem is I dont want it to do it for the entire spreadsheet just a range of cells (A4 - T59). Can anyone help me? Ive included the code below
Option Explicit
Sub NumberColorValue()
Dim R As Range
With ActiveSheet
For Each R In ActiveSheet.UsedRange
Select Case R.Interior.ColorIndex
Case 1
R.Interior.ColorIndex = 1
R.Value = 1
Case 2
R.Interior.ColorIndex = 2
R.Value = 2
Case 3
R.Interior.ColorIndex = 3
R.Value = 1
Case 4
R.Interior.ColorIndex = 4
R.Value = 4
Case 5
R.Interior.ColorIndex = 5
R.Value = 5
Case 6
R.Interior.ColorIndex = 6
R.Value = 3
End Select
Next R
End With
End Sub
Option Explicit
Sub NumberColorValue()
Dim R As Range
With ActiveSheet
For Each R In ActiveSheet.UsedRange
Select Case R.Interior.ColorIndex
Case 1
R.Interior.ColorIndex = 1
R.Value = 1
Case 2
R.Interior.ColorIndex = 2
R.Value = 2
Case 3
R.Interior.ColorIndex = 3
R.Value = 1
Case 4
R.Interior.ColorIndex = 4
R.Value = 4
Case 5
R.Interior.ColorIndex = 5
R.Value = 5
Case 6
R.Interior.ColorIndex = 6
R.Value = 3
End Select
Next R
End With
End Sub