Jump to content
  • 0

Summing worksheet lines with result listed in a Database cell.



I'm formatting a worksheet for a job.


In the "Total Items" cell, I want the answer  =sum(B12, B13, etc.)


However, this doesn't work.


Then I tried summing the answer under the list in cell B17 and tried the formula  =B17  in cell G3. That didn't work either, even though the B17 cell showed the answer.


Please scroll down past this worksheet layout.




Then I tried writing a macro. On it's own ( with WSScript_SetResStr (Num2Str (0, n)); replaced with Message (n)), it returns 32, which is the sum of cells B12 to B16. Nice.


However, calling it with  =RUNSCRIPT('Total Items')  in cell G3, it crashes VW.


If I put  =RUNSCRIPT('Total Items')  in B17, and =B17 in G3, it makes a mess.


Any ideas or reasons would be appreciated.


procedure Total_Items;
i : integer;
n, V : real;
h : handle;

h := GetObject ('Grating - Fabrication List');
for i := 12 to 16 do
	GetWSCellValue (h, i, 2, V);
	n := n + V;
WSScript_SetResStr (Num2Str (0, n));
run (Total_Items);


Link to comment

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...