Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks both KEN and TOM. Both macros worked, except the
first total set of totals is at the 4th and every other sets are after the 5th. Any idea why? The first set is not the 5th occurrence of total? You guys are perfect, I have to say it. Without you guys, me and my friend Mary would not have been able to do anything with this project. Tom? Any idea on any resources that could help us? I love this macro thing, but i cannot figure it out. TOM i am planning to call that macro you gave my friend yesterday once this macro has added total1 and soon. But my problem now is how would the macro's formula knows the range for total2, total3 and soon without including value for total1 in total2.or include total1, total2 for total3? I added some range for testing but these are not the range that I will be looking for.. I only want the total for items C1:TOTAL1 and E1:TOTAL1. And total2 to start from total1 and whatever range C AND E to the end of total2. And total3 to start from total3 to the end of total3. This is the macro you gave me earlier TOM. Is it possible to make reference to total1 even though the values to calculate will be coming from C AND E.? Is it possible to make reference to total1 for the first calculation for range C AND E.? And for total2 only all rows after total1? BASICALLY COLUMN C AND E are the column that will be use to calculate the different totals. Sub supervisor() Dim rng As Range If Not rng Is Nothing Then rng.Offset(0, 1).Formula = _ "=SUMIF(c1:c111,""vacation"",e1:e111)" rng.Offset(0, 1).BorderAround Weight:=xlMedium End If Set rng = Cells.Find("total1") If Not rng Is Nothing Then rng.Offset(0, 1).Formula = _ "=SUMIF(C1:c111,""total"",E1:e111)-SUMIF (C1:c111,""lunch"",E1:e111)" rng.Offset(0, 1).BorderAround Weight:=xlMedium End If -----Original Message----- Hello everyone, I have been helping Wendywith her project, but i am a novice just as she. I was able to find this macro, but it is not exactly what she is looking for. it only changes the first or every total. We would like it to change every 5th occurrences of total total1. The 10th total to total2. etc...and after every occurrence it creates 5 blank rows above the replace total1. Could someone help us please? I am embarrassed to ask TOM because he has been of extreme help through out this project Sub find() Dim rFound As Range Dim szFirst As String ThisWorkbook.Worksheets(1).Activate Set rFound = Columns(1).find("total") Do While Not rFound Is Nothing ''' Store address of first occurrence If szFirst = "" Then szFirst = rFound.Address ElseIf rFound.Address = szFirst Then Exit Do ''' If we have looped around, quit End If rFound.Value = Application.Substitute (rFound.Value, _ "total", "total1") Loop End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Create macro to calculate data range for a running chart | Excel Worksheet Functions | |||
Identifying a Selected Range in a Macro | Excel Discussion (Misc queries) | |||
Macro to print a selected range, not entire worksheet | Excel Discussion (Misc queries) | |||
Apply a macro to a pre-selected range of cells | Excel Programming | |||
Execute a Macro when specific value is selected in a Range | Excel Programming |