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

On 30 dec, 17:07, bijan wrote:
Hi RadarEye
Thank you,The code works perfect, but I want to ask *another question,if my
sample sheet change like this:
__field1_______field2___field3___field4__
1 2008/12/30 * * *2 * * * * * *
2 2008/12/30 * * *2 * * * * * *
3 2008/12/30 * * * * * * * * * * * * * * * *4
4 2008/12/30 * * * * * * * * * * * * * * * *3
5 2008/12/30 * * * * * * * * *10
6 2008/12/30 * * * * * * * * * 3
and I have to sum field3 and field4 and then comperess filed2 to show just
first line,How can I change your code to do that and change sheet like this:
__field1_____field2___field3___field4__
1 2008/12/30 * *2 * * * * *13 * * * * *7 *

Many Regards
Bijan * * *



"RadarEye" wrote:
Hi Bijan,


This macro compresses the lines to one for each date.


Sub BijanSum()
* * Dim intColMax As Integer
* * Dim intColLoop As Integer


* * intColMax = 4
* * Range("A3").Select
* * Do
* * * * If ActiveCell.Value = ActiveCell.Offset(-1, 0).Value Then
* * * * * * For intColLoop = 1 To intColMax
* * * * * * * * With ActiveCell
* * * * * * * * * * .Offset(-1, intColLoop).Value = _
* * * * * * * * * * .Offset(-1, intColLoop).Value + _
* * * * * * * * * * .Offset(0, intColLoop).Value
* * * * * * * * End With
* * * * * * Next
* * * * * * ActiveCell.EntireRow.Delete
* * * * Else
* * * * * * ActiveCell.Offset(1, 0).Select
* * * * End If
* * Loop Until IsEmpty(ActiveCell)
* * Range("A2").Select
End Sub


HTH,


Wouter- Tekst uit oorspronkelijk bericht niet weergeven -


- Tekst uit oorspronkelijk bericht weergeven -


Hi Bijan,

If you change
intColMax = 4
to
intColMax = 3
Only columns B C and D will be summed.
The result will be:
__field1_____field2___field3___field4__
1 2008/12/30 4 13 7

becouse you have 2 line with field2 filled.

HTH,

Wouter
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
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 11:18 AM.

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"