|
* 답변하시는 분들께 도움이 되도록 자신의 환경을 아래 항목 옆에 기재해 주세요.
1. 엑셀 버전(95,97,2000,2002):2000
2. 윈도우즈의 버전(win95,win98,winME,winNT,win2000,winXP):
3. CPU (486,PentiumI/II/III/IV...):
4. RAM (32,64,128,256,512MB,1G...):
* 아래줄에 질문을 작성하세요 >>
제친구가 해준 소스인데... ^^ 좀 해석이랄까 고수분들 부탁드려요
Sub 평균계산()
Dim 여자합계 As Integer, 남자합계 As Integer
Dim 총여자 As Integer, 총남자 As Integer
Dim Rindex As Integer, Cindex As Integer
With Worksheets("입력시트")
For Cindex = 5 To 9
총여자 = 0
총남자 = 0
남자합계 = 0
여자합계 = 0
For Rindex = 2 To 16
If .Cells(Rindex, 4) = "남" Then
남자합계 = 남자합계 + .Cells(Rindex, Cindex)
총남자 = 총남자 + 1
ElseIf .Cells(Rindex, 4) = "여" Then
여자합계 = 여자합계 + .Cells(Rindex, Cindex)
총여자 = 총여자 + 1
End If
Next Rindex
.Cells(17, Cindex) = Format(남자합계 / 총남자, "#.00")
.Cells(18, Cindex) = Format(여자합계 / 총여자, "#.00")
.Cells(19, Cindex) = Format((남자합계 + 여자합계) / (총남자 + 총여자), "#.00")
Next Cindex
End With
End Sub
|
|