CookieMonster76
Board Regular
- Joined
- Apr 30, 2015
- Messages
- 201
Hi
I have created the following to put the code in cells on multiple sheets:
For Each ws In Sheets(Array("C-H-1218 Jenner", "C-H-1219 St Peters", "C-H-1235 Moxley"))
With ws.Range("C12")
.FormulaR1C1 = "=-ROUND(SUMIFS('TB actual'!C4,'TB actual'!C3,RC[4],'TB actual'!C[-2],R3C2,0)"
.Value2 = .Value2
End With
With ws.Range("C13")
.FormulaR1C1 = "=-ROUND(SUMIFS('TB actual'!C4,'TB actual'!C3,RC[4],'TB actual'!C[-2],R3C2,0)"
.Value2 = .Value2
End With
With ws.Range("C16")
.FormulaR1C1 = "=-ROUND(SUMIFS('TB actual'!C4,'TB actual'!C3,RC[4],'TB actual'!C[-2],R3C2),0)"
.Value2 = .Value2
End With
next ws
Sine the code in the cells is the same, is there a way to reduce the lines of code on this (I am thinking specify the cells as an array also, but I don't know how to combine this with the array for the sheets)?
Thanks
Paul
I have created the following to put the code in cells on multiple sheets:
For Each ws In Sheets(Array("C-H-1218 Jenner", "C-H-1219 St Peters", "C-H-1235 Moxley"))
With ws.Range("C12")
.FormulaR1C1 = "=-ROUND(SUMIFS('TB actual'!C4,'TB actual'!C3,RC[4],'TB actual'!C[-2],R3C2,0)"
.Value2 = .Value2
End With
With ws.Range("C13")
.FormulaR1C1 = "=-ROUND(SUMIFS('TB actual'!C4,'TB actual'!C3,RC[4],'TB actual'!C[-2],R3C2,0)"
.Value2 = .Value2
End With
With ws.Range("C16")
.FormulaR1C1 = "=-ROUND(SUMIFS('TB actual'!C4,'TB actual'!C3,RC[4],'TB actual'!C[-2],R3C2),0)"
.Value2 = .Value2
End With
next ws
Sine the code in the cells is the same, is there a way to reduce the lines of code on this (I am thinking specify the cells as an array also, but I don't know how to combine this with the array for the sheets)?
Thanks
Paul