- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¥»©«³Ì«á¥Ñ GBKEE ©ó 2018-1-6 08:02 ½s¿è
¦^´_ 16# afu9240 - Function AGE(D1 As Date) 'Module1(¤@¯ë¼Ò²Õ)
- Application.Volatile (False)
- If IsDate(D1) And D1 > 0 Then
- AGE = DateDiff("m", D1, Date)
- 'AGE = Round(Int(AGE / 12), 0) & "." & AGE - (Round(Int(AGE / 12), 0) * 12) ' ¤p¼ÆÂI¬°³Ñ¾l¤ë¥÷
- '***¦¹AGEªºµ{¦¡½X¤¤** & "." & ** ¶Ç¦^¤å¦r¤£¯àpºâ,¥ÎVAL()¨ç¼Æ±N¤å¦rÂର¼Æ¦r,¥ipºâ
- AGE = Val(Round(Int(AGE / 12), 0) & "." & AGE - (Round(Int(AGE / 12), 0) * 12)) ' ¤p¼ÆÂI¬°³Ñ¾l¤ë¥÷
-
- 'AGE = Round((AGE / 12), 2) '¤p¼ÆÂI¬°10¶i¦ì '***¦¹AGE¶Ç¦^¼Æ¦r,¥ipºâ
-
- End If
- End Function
½Æ»s¥N½X- Private Sub CommandButton1_Click()
- With Worksheets("¤Hû¦~¸ê¤ÀªRªí")
- If .AutoFilterMode Then .UsedRange.AutoFilter
- End With
- End
- End Sub
- 'Private Sub CommandButton4_Click() '*****
- Private Sub ComboBox4_Change() '¥i§ï¥ÎChange¤£¶·¦A«ö¬d¸ß
- Dim Rng As Range, AGE_Average As Double
- 'If ComboBox4.ListIndex = -1 Then MsgBox "½Ð¿é¤J¥¿½TªºÈ": Exit Sub
- If ComboBox4.ListIndex = -1 Then Exit Sub '.ListIndex = -1 ¤£¦b²M³æªº¤º®e
- Set Rng = Worksheets("¤Hû¦~¸ê¤ÀªRªí").Range("A2")
- If Rng.Parent.AutoFilterMode Then Rng.AutoFilter '¨ú®ø¦Û°Ê¿z¿ï
- Set Rng = Range(Rng, Rng.End(xlToRight).End(xlDown))
- Rng.AutoFilter 1, ComboBox4.Value
- Set Rng = Range(Rng.Cells(2, 1), Rng.End(xlToRight).End(xlDown)).SpecialCells(xlCellTypeVisible)
- AGE_Average = Round(Application.WorksheetFunction.Average(Rng.Columns("G")), 2)
- MsgBox ComboBox4 & " ³¡ªù" & vbLf & "¥§¡¦~ÄÖ " & AGE_Average
-
- With Worksheets("¤u§@ªí1")
- .Cells.Clear
- Rng.Copy .[a1]
- With .Range("g1", .Range("g1").End(xlDown).Address)
- .Cells(.Count + 1) = "=Average(" & .Cells.Address & ")"
- .Cells(.Count + 1).NumberFormatLocal = "0.00_)"
- End With
- End With
- End Sub
½Æ»s¥N½X |
|