Link to home
Start Free TrialLog in
Avatar of systems_ax
systems_ax

asked on

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)"
Avatar of chwong67
chwong67
Flag of Malaysia image

One option:

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

ASKER

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)"
can anyone help?
wow, I cannotbelieve noone had responded, i've asked one question in several months and can't even get help.
Avatar of Guy Hengel [angelIII / a3]
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

ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial