答案:Private Sub CommandButton1_Click()
dim s1 As Single,s2 As Single,s3 As Single,ss1 As Single
dim i as long,k as long
ss1=0
k=0
for i = 1 to 6000
s1= val(me.cell(i,1)) s2= val(me.cell(i,2))
if s1>0 then
if s1=1 then
ss1=ss1+s2'求蓝色和
else
if s1=2 then
k=k+1'黄色的个数
endif
endif
endif
next
for i = 1 to 6000
s1= val(me.cell(i,1))
if s1=2 then
s2= val(me.cell(i,2))
me.cell(i,3)=s2+ss1/k
endif
next
End Sub
其他:你的问题不明确,不过看样子,用VBA,很容易解决,可以联系我
上一个:卖计算机国二VB答案的人可靠吗?也就是那答案是真的吗?求解!非诚勿扰!谢谢!
下一个:vb中退出时如何自动保存所选的单选按钮