Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Modification to SUMIF code request

All,

I have the following code. Currently the code runs using a SUM IF
function. However this works for basically everything in column R
(code range) that is a unique value and sums it. There is another
column in the spreadsheet (Column Q). This has another set of values
in it. I would like to modify this macro to work only if column Q
contains certain data which would be defined in the macro. For
exammple if column Q contains the word 'forge' then the macro will run
only on the rows that have 'forge in them.

Some usefull advice has been given on using the sum product furnction
instead of the SUMIF function, but I still cant get it to work.

Any advice you may have would be greatly appreciated.

Regards

Joseph Crabtree

........................................


Sub MasterSummarySheet()


With Sheets("Data")
LastRow = Sheets("Data").Range("R" & Rows.Count).End(xlUp).Row
Set CodeRange = .Range("R2:R" & LastRow)
Set SumRange = .Range("U2:U" & LastRow)

End With

Sheets("data").Activate
Range("R1", "R" & LastRow).Select
Selection.AdvancedFilter Action:=xlFilterInPlace, Unique:=True
Selection.Copy Sheets("output").Range("A20")
ActiveSheet.ShowAllData

Set CriteriaRange = Sheets("Output").Range("A21")
For r = 2 To Sheets("Output").Range("A21").End(xlDown).Row
Total = WorksheetFunction.SumIf(CodeRange, CriteriaRange,
SumRange)
CriteriaRange.Offset(0, 1) = Total
Set CriteriaRange = CriteriaRange.Offset(1, 0)
Next

End Sub
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
Extract Data Code Modification Request joecrabtree Excel Programming 1 March 16th 09 09:14 AM
Code modification help AndyMP Excel Worksheet Functions 1 February 8th 09 11:41 PM
Help 2nd request (sumif formula of similar 17-04-08) Joco Excel Discussion (Misc queries) 2 April 20th 08 01:56 PM
Code modification help please Tom Excel Programming 2 April 10th 07 06:44 PM
Modification in the CODE to HIDE rows and columns that start with ZERO (code given) Thulasiram[_2_] Excel Programming 4 September 26th 06 04:15 AM


All times are GMT +1. The time now is 10:06 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"