Results 1 to 3 of 3

Thread: On Going Calculation

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member
    Join Date
    Dec 2013
    Posts
    7
    Rep Power
    0

    On Going Calculation

    I’m trying to write a code to do whole a sheet with , On Going Calculation . I have uploaded a worksheet sample. it is easier for me to show than me trying to explain. my trying to explain gets everyone confused .

    I also posted this on Excel.com Forum, a couple days ago but never receive a reply back.

    I was wanting a sheet to sheet, but I have changed my spread sheet and put everything on the same sheet
    I tried writing a code for each column from BR6 to DP20 to go to each section Cell and column starting at GU3 . One of the members at excel.com a while back show me how to write a on- going calculation to go To one cell , which is what I had asked for and it worked. But trying to write it for more than one cell, not only did my attempt to write code not work, it clear all the value figures in the entire section. So I exited out and clicked do not save. So I need the experts’ advice again.
    Below was my attempt at writing a code. I put the Value +1 in it so would just add 1 to the the cell it was going to and not the box number that won the race.
    Example on sample sheet the number (value) in BY7 is 5 and it would go to sample B sheet 2 AK3 as 1. All the numbers in sheet 1 from BY7 to DP20 are just box numbers, my goal is to see who many times each box comes in.

    Code:
    Private Sub Worksheet_Change(ByVal Target As Excel.Range)
          With Target
             If .Address(False, False) = "BY6:DP20" Then
                If IsNumeric(.Value) Then
                   Application.EnableEvents = False
                   Range("GU3").Value = Range("HB3").Value + 1
                   Range("GB4").Value = Range("HB4").Value + 1
                   Range("GB5").Value = Range("HB5").Value + 1
                    Range("GB6").Value = Range("HB6").Value + 1
                   Range("GB12").Value = Range("HB12").Value + 1
                  Range("GB13").Value = Range("HB13").Value + 1
                   Range("GB14").Value = Range("HB14").Value + 1
                  Range("GB15").Value = Range("HB15").Value + 1
                 Application.EnableEvents = True
                End If
                End If
               End With
                End Sub
    I only tried 2 sections but the codes did not work. I would like to know how to write a proper code starting at GU3, so it will send the correct value to each cell . Grade A will go to Grade A info section Grade B to Grade B ,etc.
    Also is there a way to make this a 30 day results so after 30 days when it add day 31 it will go back to the first day so it becomes a continues 30 days results.

    Due to size only part of sample 1 is shown. but BY6 to DP20 is where the results number appear after I download the results each day.
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Below is a copy of the help I received from the excel.com member. his help worked for what I asked for, he did a great job. I was hoping after I saw how to get started I
    could go from there and complete the whole sheet on my own. Sorry to say that did not happen.

    The title of my Thread on excelforum.com is Sheet to Sheet On Going calculation .
    ----------------------------------------------------------------------------------------
    ongoing calculator Formula

    Here are the step by step instructions on using the VBA event macro. This is your best option for the task at hand.

    Cell A1 is where the new entry is made and cell B8 is the running total.

    In Excel 2007 (as your profile indicates)...

    Open the file where this is to be used
    Select the sheet where this is to be used
    Right click the sheet tab
    Select: View Code (this will open the VB editor)
    Copy the code below and paste it into the window that opens on the right hand side of the screen:

    [Select Code] copy to clipboard

    Code:
    Private Sub Worksheet_Change(ByVal Target As Excel.Range)
              With Target
                 If .Address(False, False) = "BY6" Then
                    If IsNumeric(.Value) Then
                       Application.EnableEvents = False
                       Range("BG").Value = Range("BG7").Value + .Value
                       Application.EnableEvents = True
                    End If
                 End If
              End With
        End Sub
    Close the VB editor to return to Excel

    Try it out. Enter some numbers in cell A1 and observe cell B8.

    If you want to reset the total just delete the contents of cell B8.

    You'll have to save the file as a macro enabled file in the *.xlsm file format.
    -----------------------------------------------------------------------------------------------------------

    one page sample

    Code:
    Private Sub Worksheet_Change(ByVal Target As Excel.Range)
              With Target
                 If .Address(False, False) = "AP1" Then
                    If IsNumeric(.Value) Then
                       Application.EnableEvents = False
                       Range("AN1").Value = Range("AN1").Value + .Value
                       Application.EnableEvents = True
                    End If
                 End If
              End With
        End Sub
    Attached Files Attached Files
    Last edited by Admin; 12-30-2013 at 11:56 AM. Reason: code tag added

Similar Threads

  1. Replies: 5
    Last Post: 10-21-2013, 04:43 PM
  2. Correcting “Negative” Time Difference Calculation in Excel
    By Transformer in forum Tips, Tricks & Downloads (No Questions)
    Replies: 0
    Last Post: 05-17-2013, 12:32 AM
  3. Formula Following Order Of Calculation BODMAS
    By paul_pearson in forum Excel Help
    Replies: 7
    Last Post: 03-27-2013, 02:07 PM
  4. Hours Calculation between two times
    By excel_learner in forum Excel Help
    Replies: 3
    Last Post: 11-21-2012, 05:04 PM
  5. Calculation with different condition in a cell
    By LalitPandey87 in forum Excel Help
    Replies: 5
    Last Post: 04-04-2012, 08:38 AM

Posting Permissions

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