+ Reply to Thread
Results 1 to 6 of 6

Sum differents worksheets

  1. #1
    Forum Contributor
    Join Date
    01-03-2016
    Location
    Rio de Janeiro, Brazil
    MS-Off Ver
    2016
    Posts
    125

    Sum differents worksheets

    I don't know what I'm doing wrong in order to sum these values from different worksheets

    Please Login or Register  to view this content.

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Sum differents worksheets

    Hi.

    There's nothing syntactically wrong with that line, though I'm not sure why one of the values within the sum comes from precisely the same cell in which you're entering the formula.

    Unless you're intending to iterate this code many times, I can't really see the benefit of your set-up.

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Forum Contributor
    Join Date
    01-03-2016
    Location
    Rio de Janeiro, Brazil
    MS-Off Ver
    2016
    Posts
    125

    Re: Sum differents worksheets

    I'm thinking in something like a counter (count = count + 1), but in this case, it "count" would be Worksheets("test1").Range("B8").value.

    Roughly it would be (it's a draft):
    Worksheets("test1")."B8" = (Worksheets("test1")."B8") + (Worksheets("test2")."K" & lastrow - 1)

    if B8 = 100 and lrTest = 22, and then, K22 = 200
    B8+K22 = 100 + 200 = 300 (new value for B8)
    Next row would be 23, and K23 = 500, for example, then:
    B8+K23 = 300 + 500 = 800

  4. #4
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Sum differents worksheets

    So you mean you want to loop lrTest through a range of values? How is this range defined?

    Regards

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Sum differents worksheets

    Hi,

    Apart from the circular reference that XOR has alluded to why not just

    Please Login or Register  to view this content.
    Your method of building from separate strings isn't inherently wrong but remember stuff like
    Please Login or Register  to view this content.
    isn't a string. To do it this way you'd have to convert the VBA object Worksheets("Test1") to a string by adding the .Name.

    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  6. #6
    Forum Contributor
    Join Date
    01-03-2016
    Location
    Rio de Janeiro, Brazil
    MS-Off Ver
    2016
    Posts
    125

    Re: Sum differents worksheets

    Sorry!! My bad! Everything was working, but instead of writing the value cell (C8), I used the text cell (B8).
    Thank you for your time, XOR LX and Richard.
    Last edited by luizmachado; 02-02-2016 at 11:56 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Differents dates in differents sheets
    By luizmachado in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-30-2016, 12:57 PM
  2. Activate custom ribbon tabs for differents sheets
    By Deutz in forum Excel General
    Replies: 2
    Last Post: 07-30-2015, 02:30 AM
  3. [SOLVED] Copy and Paste differents ranges
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 01-21-2015, 12:10 PM
  4. Check cell and sum differents worksheets
    By Salivan in forum Excel General
    Replies: 4
    Last Post: 05-13-2014, 12:13 PM
  5. Excel file with differents format of date
    By KateBackOffice in forum Excel General
    Replies: 1
    Last Post: 11-13-2013, 02:04 PM
  6. separate data of differents countries in others sheets
    By silviario in forum Excel General
    Replies: 6
    Last Post: 04-27-2011, 03:14 PM
  7. Join differents words in cells seperated by ;
    By corvito in forum Excel General
    Replies: 8
    Last Post: 04-08-2007, 11:02 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