View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ram Ram is offline
external usenet poster
 
Posts: 138
Default Code for multiple columns and rows

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 dont copy it 12 times for
each category it would be great.

Thanks for any help.