LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 735
Default vba solution

The following code does what you require......
it uses a worksheet Sheet2 to add your summary data.

Sub Summarise()
Dim lFRow As Long, lCRow As Long, lSRow As Long
Dim bF4 As Boolean, iCol As Integer, sDate As String

lCRow = 2 ' first row of data
lSRow = 1 ' first report row on summary sheet2

With Worksheets("Sheet1")
Do While lCRow <= .Cells(.Rows.Count, "A").End(xlUp).Row
sDate = .Cells(lCRow, "A")
lFRow = lCRow
bF4 = False
Do While sDate = .Cells(lCRow, "A")
If .Cells(lCRow, 4) 0 Then bF4 = True
lCRow = lCRow + 1
Loop
If bF4 Then
Sheets("Sheet2").Cells(lSRow, 1) = sDate
For iCol = 2 To 5
Sheets("Sheet2").Cells(lSRow, iCol) = _
Application.WorksheetFunction.Sum _
(.Range(.Cells(lFRow, iCol), .Cells(lCRow - 1, iCol)))
Next
lSRow = lSRow + 1
End If
Loop
End With
End Sub

--

Regards,
Nigel




"bijan" wrote in message
...
Hi Nigel
please guide me how can I define a such rule,I have just need to sum
field4
and summerize other fields in one row all with same date.
Many Regards
Bijan

"Nigel" wrote:

Can you expand on the rule for the data to be summarized. You say "Field
4
.... records exist more than one.... and same date"

If there is only one value for field 4 in the same date range then no
action
should take place?
Is it the same dates between the first and last Field4 values, as shown
in
your example?

--

Regards,
Nigel




"bijan" wrote in message
...
Hi Experts,
Happy new year in advance,
I have a sheet with huge data and some of part these data show data
like
this:
__field1_____field2___field3___field4___field5__
1 2008/12/30 1
2 2008/12/30 5
3 2008/12/30 4
4 2008/12/30 2
5 2008/12/30 10
6 2008/12/30 3
I need a vba code first check field4 and if records exist more than one
with
same date sum those data and put other records in to the one row like
this:
__field1_____field2___field3___field4___field5__
1 2008/12/30 2 5 14 4

Thanks
Bijan





 
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
Looking for a solution CA Linda Excel Worksheet Functions 1 July 7th 09 05:31 PM
best solution for db Nader Tewelde Excel Programming 0 July 9th 07 11:25 AM
My solution Research freak Excel Discussion (Misc queries) 0 April 11th 07 04:30 PM
Is There A Solution.......? Thyagaraj Excel Programming 3 August 8th 06 03:59 PM
Best Fit Solution Tom Ogilvy Excel Programming 0 August 26th 04 05:34 PM


All times are GMT +1. The time now is 04:21 PM.

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

About Us

"It's about Microsoft Excel"