Private Sub CommandButton1_Click()
For i = 1 To Sheets.Count - 1
Dim shet
Dim shetd
shetd = "a" + Trim(str(i))
shet = "b" + Trim(str(i))
For j = 1 To 100
Dim sss
sss = "A" + Trim(str(j)) //数字转换成字符,截取掉空格,拼合成一个单元格地址
Dim ccc
ccc = Sheets(i).Range(sss).Value //获得某页某个单元格的内容
Dim d
d = Sheets(i).Name //获得某个sheet的名称
If ccc = "合计" Then
Dim row
row = "t" + Trim(str(j))
Sheets("统计").Range(shetd) = d //设置某个单元格的值
Sheets("统计").Range(shet) = Round(Sheets(i).Range(row).Value, 2)
End If
Next j
Next i
End Sub
Private Sub CommandButton2_Click()
For i = 1 To Sheets.Count - 1
Dim shet
Dim shetd
shetd = "a" + Trim(str(i))
shet = "b" + Trim(str(i))
For j = 1 To 100
Dim sss
sss = "A" + Trim(str(j))
Dim ccc
ccc = Sheets(i).Range(sss).Value
Dim d
d = Sheets(i).Name
If ccc = "平均" Then
Dim row
row = "t" + Trim(str(j))
Sheets("统计").Range(shetd) = d
Sheets("统计").Range(shet) = Round(Sheets(i).Range(row).Value, 2)
End If
Next j
Next i
End Sub