sooty8
04-21-2010, 03:48 AM
Hi All
The first array below I'm using and it works OK - I have had to change it to the 2nd Macro - question is there an easier way to change it without entering each change individually. I have to do this on a fairly regular basis.
Sub Macro1()
Dim arr, a
arr = Array(10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, _
50, 52, 54, 56, 58, 60, 62, 63, 65, 67, 69, 71, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, _
106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, _
152, 154, 156, 158, 160, 162, 164, 165, 167, 169, 170, 171, 173, 175, 177, 179, 181, 183, 185, 186, 188, 190, 192, 194, _
196, 198, 200, 202, 204, 206, 208, 210, 212, 214)
Sheets("Invoice").Select
For Each a In arr
With Range("M" & a)
.FormulaR1C1 = "=SUM(R[-1]C[-9]:RC[-1])"
.Interior.Color = 10079487
End With
Next
End Sub
Sub Macro2()
Dim arr, a
arr = Array(10, 11, 13, 15, 16, 18, 20, 22, 24, 26, 28, 30, 32, 33, 37, 39, 41, 43, 45, 47, _
49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81)
Sheets("Invoice").Select
For Each a In arr
With Range("M" & a)
.FormulaR1C1 = "=SUM(R[-1]C[-9]:RC[-1])"
.Interior.Color = 10079487
End With
Next
End Sub
Many Thanks
Sooty 8
The first array below I'm using and it works OK - I have had to change it to the 2nd Macro - question is there an easier way to change it without entering each change individually. I have to do this on a fairly regular basis.
Sub Macro1()
Dim arr, a
arr = Array(10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, _
50, 52, 54, 56, 58, 60, 62, 63, 65, 67, 69, 71, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, _
106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, _
152, 154, 156, 158, 160, 162, 164, 165, 167, 169, 170, 171, 173, 175, 177, 179, 181, 183, 185, 186, 188, 190, 192, 194, _
196, 198, 200, 202, 204, 206, 208, 210, 212, 214)
Sheets("Invoice").Select
For Each a In arr
With Range("M" & a)
.FormulaR1C1 = "=SUM(R[-1]C[-9]:RC[-1])"
.Interior.Color = 10079487
End With
Next
End Sub
Sub Macro2()
Dim arr, a
arr = Array(10, 11, 13, 15, 16, 18, 20, 22, 24, 26, 28, 30, 32, 33, 37, 39, 41, 43, 45, 47, _
49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81)
Sheets("Invoice").Select
For Each a In arr
With Range("M" & a)
.FormulaR1C1 = "=SUM(R[-1]C[-9]:RC[-1])"
.Interior.Color = 10079487
End With
Next
End Sub
Many Thanks
Sooty 8