Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #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.

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

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



"ram" wrote:

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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Shading multiple rows or, alternately, multiple columns only Lawrence Miller Excel Discussion (Misc queries) 5 December 1st 08 12:05 PM
Delete Blank Rows Code - Multiple Worksheets - Multiple Documents BenS Excel Discussion (Misc queries) 3 June 29th 07 12:20 AM
Excel Convert Multiple Rows into Multiple Columns [email protected] Excel Worksheet Functions 1 June 28th 07 05:20 AM
Combine multiple columns into two long columns, Repeating rows in first column [email protected] Excel Discussion (Misc queries) 2 July 31st 06 09:45 PM
Combine multiple columns into two long columns, Repeating rows in first column [email protected] Excel Discussion (Misc queries) 0 July 31st 06 05:07 PM


All times are GMT +1. The time now is 08:55 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"