由买买提看人间百态

topics

全部话题 - 话题: wsum
(共0页)
B*******e
发帖数: 3882
1
偶是现学现卖, 应该是酱紫.
数据从第一行开始
第一列是gdp, 第二列是需要算的值, 结果存到第三列
假设每一worrksheet 是一年的.
其他格式相应改一下就可以了
把nCountry 改成实际的国家值
Sub gdp1()
'
' gdp1 Macro
' Macro recorded 3/19/2003 by Backyard
'
' Keyboard Shortcut: Ctrl+e
'
Dim nCountry As Integer
nCountry = 8
Dim gdpSum As Double
gdpSum = 0
Dim i As Integer, j As Integer
i = 1
j = 1
Do While (i <= nCountry)
gdpSum = gdpSum + Cells(i, 1)
i = i + 1
Loop
Cells(nCountry + 2, 1) = gdpSum
Dim wSum As Double
wSum = 0
i = 1
(共0页)