need to know how to sum numbers in column G of excel spreadsheet in VBsedit. visual basic

i have an external excel spreadsheet version 2003, column A contains about 5 rows of numeric values.  i need to create a SUM function in vbsedit that totals these rows from column A in excel and passes it as a variable within my vbsedit script.  i need step-by-step as  I can't find sum function within vbsedit program at all.

my range is Range("A2:A100") and I need to create a vbsedit script and then pass the total into the following function where r is going to be this total from coulmn A.

line="SCH" & sep & r & sep & "EA***169*20(ddate)"
LVL 1
systems_axAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chwong67Commented:
One option:

Dim i As Integer
Dim r As Integer
For i = 2 To 100
     r += objSheet.Range("A" & i).Value
Next
systems_axAuthor Commented:
thank you very much for respoding but it did not work....errored out w/ "end of statement expected"..please help

Dim i As Integer
Dim r As Integer
For i = 2 To 100
     r += objSheet.Range("G" & i).Value
Next

 
isa = "ISA*00*          *00*          *12*(senderX)*01*(receiverX)*(ddate)*(dtime)*U*00401*(ccode)*0*P*>~GS*IB*(sender)*(receiver)*20(ddate)*(dtime)*(ccode2)*X*004010"
biaST = "ST*846*0001~BIA*00*SI" & sep & Vendor & sep & "20(ddate)"
item = "LIN**VP*(Column2)*DP*N~QTY*33*(Column7)*EA"
line="SCH" & sep & r & sep & "EA***169*20(ddate)"
systems_axAuthor Commented:
can anyone help?
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

systems_axAuthor Commented:
wow, I cannotbelieve noone had responded, i've asked one question in several months and can't even get help.
Guy Hengel [angelIII / a3]Billing EngineerCommented:
the "r += xx" syntax won't work indeed...
you need the plain "r = r + xxx" ...

Dim i As Integer
Dim r As Integer
For i = 2 To 100
     r = r + objSheet.Range("A" & i).Value
Next

Open in new window

Guy Hengel [angelIII / a3]Billing EngineerCommented:
you might instead also use the worksheetfunction stuff:
Dim r as integer
r = Application.WorksheetFunction.Sum(objSheet.Range("A1:A200¿))

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.