Results 1 to 1 of 1

Looping AutoSum Sub Total and Total

Threaded View

  1. #1
    Forum Expert
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,513

    Looping AutoSum Sub Total and Total

    i have Makro what wrong with my Code ,i want
    1. autoSum in every in col B =Sub then in Range J will autoSum
    2. AutoSUm in evey in Col B = TOTAL BIAYA LANGSUNG PERSONIL (a + b) then sub total 1 + sub total 2
    3.AutoSum all Sub if col B= "TOTAL"

    Sub MyCalculate()
    Dim i, LR, c As Long: LR = Range("H" & Rows.Count).End(xlUp).Row
    Dim Rng, RngSum As Range
    Dim BarisAwal As Long
    Dim bool As Boolean: bool = True
    With Application
         .DisplayAlerts = False
         .ScreenUpdating = False
         .Calculation = xlCalculationManual
    End With
     
        With ActiveSheet
            For Each Rng In .Range("F23:F" & LR)
             
            
                If .Range("F" & Rng.Row) <> "" And IsNumeric(.Range("E" & Rng.Row)) _
                And IsNumeric(.Range("G" & Rng.Row)) And .Range("E" & Rng.Row) > 0 Then
                 If BarisAwal < 1 Then BarisAwal = Rng.Row
                              .Range("J" & Rng.Row & ",N" & Rng.Row).FormulaR1C1 = "=RC[-1] * RC[-3]* RC[-5]"
                              .Range("N" & Rng.Row).FormulaR1C1 = "=RC[-1] * RC[-3]* RC[-5]"
                              .Range("P" & Rng.Row).FormulaR1C1 = "=RC[-1] * RC[-7]"
                              .Range("R" & Rng.Row).FormulaR1C1 = "=RC[-1] * RC[-9]"
                              .Range("S" & Rng.Row & ",T" & Rng.Row).FormulaR1C1 = "=RC[-2] + RC[-4]"
                              
                     
                              
                         ElseIf .Range("H" & Rng.Row) <> "" And IsNumeric(.Range("F" & Rng.Row)) And _
                              .Range("F" & Rng.Row) > 0 Then
                              .Range("J" & Rng.Row).FormulaR1C1 = "=RC[-1] * RC[-4]"
                              .Range("N" & Rng.Row).FormulaR1C1 = "=RC[-2] * RC[-5]"
                              .Range("P" & Rng.Row).FormulaR1C1 = "=RC[-1] * RC[-7]"
                              .Range("R" & Rng.Row).FormulaR1C1 = "=RC[-1] * RC[-9]"
                              .Range("S" & Rng.Row & ",T" & Rng.Row).FormulaR1C1 = "=RC[-2] + RC[-4]"
                       
                ElseIf Left(.Range("B" & Rng.Row), 3) = "Sub" Then
               
                      .Range("J" & Rng.Row) = "=Sum(J" & BarisAwal & ":J" & Rng.Row - 1 & ")"
                     
                      
               End If
             
            Next
        End With
    
      With Application
         .DisplayAlerts = True
         .ScreenUpdating = True
         .Calculation = xlCalculationAutomatic
      End With
     
    End Sub
    Attached Files Attached Files
    Last edited by JBeaucaire; 10-14-2016 at 04:42 PM. Reason: Added missing CODE tags. Please read and follow the Forum Rules, link above in the menu bar!! Thanks.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Pivot Chart Running Total - Removing Current Year Future Total
    By car3489 in forum Excel Charting & Pivots
    Replies: 5
    Last Post: 07-27-2013, 03:35 AM
  2. Sub-Total / Total / Grand Total Help Needed
    By jenniferexcel in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-16-2013, 12:00 PM
  3. Autosum VBA: formating the Total
    By mr_mango81 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-21-2013, 06:02 PM
  4. Looping and adding to give one total in one cell.
    By kiwiingrid in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-09-2012, 02:49 PM
  5. Autosum column by searching through row 1 for the word total in first cell of the col
    By daillest319 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 02-21-2012, 03:18 PM
  6. Find total time taken by each person to process total number of letters.
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-07-2010, 10:04 AM
  7. Looping through a range:find the largest total.
    By Shawn in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-03-2005, 04:05 PM
  8. [SOLVED] How do I Autosum a running column total in excel?
    By JR5280 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-18-2005, 10:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1