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)"
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)"
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*(receiver X)*(ddate) *(dtime)*U *00401*(cc ode)*0*P*> ~GS*IB*(se nder)*(rec eiver)*20( ddate)*(dt ime)*(ccod e2)*X*0040 10"
biaST = "ST*846*0001~BIA*00*SI" & sep & Vendor & sep & "20(ddate)"
item = "LIN**VP*(Column2)*DP*N~QT Y*33*(Colu mn7)*EA"
line="SCH" & sep & r & sep & "EA***169*20(ddate)"
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*(receiver
biaST = "ST*846*0001~BIA*00*SI" & sep & Vendor & sep & "20(ddate)"
item = "LIN**VP*(Column2)*DP*N~QT
line="SCH" & sep & r & sep & "EA***169*20(ddate)"
ASKER
can anyone help?
ASKER
wow, I cannotbelieve noone had responded, i've asked one question in several months and can't even get help.
the "r += xx" syntax won't work indeed...
you need the plain "r = r + xxx" ...
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Dim i As Integer
Dim r As Integer
For i = 2 To 100
r += objSheet.Range("A" & i).Value
Next