Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8973031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:21:29+00:00 2026-06-15T18:21:29+00:00

I am performing a VB function to sort out cumulative amount within a specified

  • 0

I am performing a VB function to sort out cumulative amount within a specified period with different categories. The objective is for personnel account expenses.

For example, I have in a sheet “tmp” in column A some dates, in column B a category (eg. Salary, Transport …) and in column C the values.

I want to define a function and I have tried to set:

Function Cumulatif(Categorie As String, Debut As Date, Fin As Date) As Double
    ' Do the sum of a category between a starting and ending date specified 
    Dim Operations As Variant
    Dim SpecificSum As Double
    Dim i As Integer
    Operations = ThisWorkbook.Sheets("tmp").Range("A1:C3")
    For Each Row In Operations.Rows
        SpecificSum = 0
    Next
    Cumulatif = SpecificSum
End Function

But I don’t really know how to get the values from another sheet and do the loop in the range to set this sum. Can somebody help me on this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T18:21:30+00:00Added an answer on June 15, 2026 at 6:21 pm
    1. The assigment to operations needs to be an object assignment, meaning: use Set (not Let/default).

      Set Operations = ThisWorkbook.Sheets(“tmp”).Range(“A1:C3)

    2. You can get the values from the other sheet (assuming you mean “tmp”) as follows

      SpecificSum = SpecificSum + Row.Cells(1, 1)
      

    I think you’d be better off having the function take an additional range parameter and supplying Sheet1!A as an argument; this way Excel will know when it needs to recalculate.

    Function Cumulatif(Categorie As String, Debut As Date, Fin As Date, Operations As Range) As Double
        ' Do the sum of a category between a starting and ending date specified
        'Dim Operations As Variant
        Dim SpecificSum As Double
        Dim i As Integer
        'Set Operations = ThisWorkbook.Sheets("Sheet1").Range("A2:C3")
        For Each Row In Operations.Rows
            SpecificSum = SpecificSum + Row.Cells(1, 1)
        Next
        Cumulatif = SpecificSum
    End Function
    

    And call Cumulatif using such a formula:

    =Cumulatif("hello9","10/1/2010", "10/31/2010",Sheet1!A2:A3)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am wondering how I would go about performing a certain function if a
while I am performing the edit function .. i have a textarea where i
I am performing the following AJAX call: $(document).ready(function() { $.getJSON('https://sendgrid.com/api/user.stats.json', { 'api_user': 'me@mydomain.com', 'api_key':
I'm wondering on how I could achieve performing a conditional function based on what
Pretty basic question I think - I'm performing this function: private double convertMetersToFeet(double meters)
I am performing a bitwise function on 32- and 64-bit integers, and got stuck
When performing a getJSON function, and I want to send some data to the
Microsoft offers the InterlockedCompareExchange function for performing atomic compare-and-swap operations. There is also an
I have got below JQuery where I am performing the .load function. $(.load-fragment).each(function() {
I have my php app working fine, performing some other Graph API functions. However,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.