Xrull
07-03-2009, 09:57 AM
Hello,
I'm trying to write this formula as a VBA code:
=SUMIF(All!$P:$P,$C7&E$2&E$3,All!$I:$I)
Using VBA
Is there a way to replicate this code, so I don't have to do the
about 135 times?
With Sheets("Summary1")
With .Range...
Sub Macroz()
With Sheets("Summary1")
With .Range("B7", .Range("B" & Rows.Count).End(xlUp)).Offset(, 3)
.Formula = "=SUMIF(All!$P:$P,$C7&E$2&E$3,All!$I:$I)"
.Value = .Value
With Sheets("Summary1")
With .Range("B7", .Range("B" & Rows.Count).End(xlUp)).Offset(, 4)
.Formula = "=SUMIF(All!$P:$P,$C7&F$2&F$3,All!$I:$I)"
.Value = .Value
End With
With Sheets("Summary1")
With .Range("B7", .Range("B" & Rows.Count).End(xlUp)).Offset(, 5)
.Formula = "=SUMIF(All!$P:$P,$C7&G$2&G$3,All!$I:$I)"
.Value = .Value
End With
End With
End With
End With
End With
End Sub
This code works within the range E7:EI71
I crossed posted two threads here:
http://www.mrexcel.com/forum/showthread.php?t=400260&highlight=xrull
http://www.mrexcel.com/forum/showthread.php?t=400358&highlight=xrull
I'm trying to write this formula as a VBA code:
=SUMIF(All!$P:$P,$C7&E$2&E$3,All!$I:$I)
Using VBA
Is there a way to replicate this code, so I don't have to do the
about 135 times?
With Sheets("Summary1")
With .Range...
Sub Macroz()
With Sheets("Summary1")
With .Range("B7", .Range("B" & Rows.Count).End(xlUp)).Offset(, 3)
.Formula = "=SUMIF(All!$P:$P,$C7&E$2&E$3,All!$I:$I)"
.Value = .Value
With Sheets("Summary1")
With .Range("B7", .Range("B" & Rows.Count).End(xlUp)).Offset(, 4)
.Formula = "=SUMIF(All!$P:$P,$C7&F$2&F$3,All!$I:$I)"
.Value = .Value
End With
With Sheets("Summary1")
With .Range("B7", .Range("B" & Rows.Count).End(xlUp)).Offset(, 5)
.Formula = "=SUMIF(All!$P:$P,$C7&G$2&G$3,All!$I:$I)"
.Value = .Value
End With
End With
End With
End With
End With
End Sub
This code works within the range E7:EI71
I crossed posted two threads here:
http://www.mrexcel.com/forum/showthread.php?t=400260&highlight=xrull
http://www.mrexcel.com/forum/showthread.php?t=400358&highlight=xrull