Code for multiple columns and rows

R

ram

I would like to know if the following code can be reduced:
In the code below the value for ‘processed Amount’!B1 is the date 1/1/2006.
I currently copy the four lines of code and change cells B1 and B2 to the
next columns C1 and C2… M1 and M2. This gives me the data I need for all 12
months.

Dim jan As String, feb As String, mar As String, apr As String, may As
String, jun As String, jul As String, aug As String, sep As String, oct As
String, nov As String, dec As String
Dim v As Variant

‘Total CSO Reimbursements Processed
jan = "=SumProduct(--(Sheet4!A1:A30000=" & _
"'processed Amount'!B1),--(Sheet4!AL1:AL30000 > 0))"
v = Evaluate(jan)
Range("B2") = v

If there is a way to reduce the code so that I don’t copy it 12 times for
each category it would be great.

Thanks for any help.
 
R

ram

jan = "=SumProduct(--(Sheet4!A1:A30000=" & _
"'processed Amount'!B1),--(Sheet4!AL1:AL30000 > 0))"
v = Evaluate(jan)
Range("B2") = v
is there a way to loop through this code and offsett cell B1 and B2 each
time the loop is completed?

Thanks for any help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top