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;
var
i : integer;
n, V : real;
h : handle;
begin
h := GetObject ('Grating - Fabrication List');
for i := 12 to 16 do
begin
GetWSCellValue (h, i, 2, V);
n := n + V;
end;
WSScript_SetResStr (Num2Str (0, n));
end;
run (Total_Items);
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.
Question
WhoCanDo
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; var i : integer; n, V : real; h : handle; begin h := GetObject ('Grating - Fabrication List'); for i := 12 to 16 do begin GetWSCellValue (h, i, 2, V); n := n + V; end; WSScript_SetResStr (Num2Str (0, n)); end; 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.