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.
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.
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
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
So you mean you want to loop lrTest through a range of values? How is this range defined?
Regards
Hi,
Apart from the circular reference that XOR has alluded to why not just
Your method of building from separate strings isn't inherently wrong but remember stuff likePlease 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.
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.
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.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks