ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

µ{¦¡»yªk¸ß°Ý

µ{¦¡»yªk¸ß°Ý

¥»©«³Ì«á¥Ñ hcy_tp ©ó 2010-11-17 14:45 ½s¿è

¥Dµ{¦¡¡G
Private Sub CommandButton1_Click()

Dim a As Integer

For a = 57 To a = a + 2 < 72
  Call aa
Next

End Sub




°Æµ{¦¡¡G

Sub aa()      '¥»°êÄy¤@¯ë¡B¥~Äy°êÄy-¶V«n¡B¬Z´¶¹ë¡B¬Z´¶¹ë¡B®õ°ê¡Bµá«ß»«¡B¦L¥§¡B¨ä¥L

Dim strYear As String      'ÅܼÆ-²Î­pªº¦~¤ë

Dim strNo As String      'ÅܼÆ-®×¸¹ªº¦~¤ë

Dim strCountry As String 'ÅܼÆ-°êÄy

Dim intAmount As Integer      'ÅܼÆ-µ§¼Æ

Dim i, l, h, b, ii As Integer    'ÅܼÆ-Äæ ¦C

Dim j, w As Integer      'ÅܼÆ-²Î­p¼Æ



j = 0

w = 0


b = a
c = b + 1
   
    intAmount = Application.CountA(Sheets("¨ü­hªÌ").Range("A2:A65535")) + 1      '¨úµ§¼Æ

   For h = b To c
    For l = 12 To 23
   
    Select Case h
        Case Is <= 58
            ii = 37
        Case Is <= 62
            ii = 41
        Case Is <= 64
            ii = 43
        Case Is <= 66
            ii = 45
        Case Is <= 68
            ii = 47
        Case Is <= 70
            ii = 49
        Case Is <= 72
            ii = 51
   
   
    End Select
   
    strYear = Application.WorksheetFunction.Text((Sheets("©u²Î­p").Cells(2, 3) & Sheets("©u²Î­p").Cells(5, l)), 0)
    strCountry = Application.WorksheetFunction.Text((Sheets("©u²Î­p").Cells(h, 3) & "-" & Sheets("©u²Î­p").Cells(h, 4)), 0)


      '¨ú¦~¤ë¥÷-©u²Î­p
            
        For i = 2 To intAmount
      
          strNo = Mid(Sheets("¨ü­hªÌ").Cells(i, 1), 3, 4)
            
            If strNo = strYear Then        '¦~¤ë¥÷-§PÂ_®×¸¹¬O§_µ¥©ó©u²Î­p
               
                If Sheets("¨ü­hªÌ").Cells(i, 4) = "¦¨®×" Then        '¦¨®×-§PÂ_®×¥ó¬O§_¦¨®×
                    
                    If Sheets("¨ü­hªÌ").Cells(i, h - ii) = strCountry Then      '¨ü­hªÌ¥»¨­¯S®íª¬ªp-§PÂ_¨ü­hªÌ¥»¨­¯S®íª¬ªp¬O§_Äݹê
                       j = j + 1
                  
                    End If
               
                End If
            
            End If
            
            w = j
            
        Next i
        
          j = 0

          Sheets("©u²Î­p").Cells(h, l).Value = w
    Next l
    Next h

End Sub


¥i¥H°õ¦æ¡A¦ýµLªk¶]¥Xµ²ªG­È³£¬O¡Aª½±µ¥d¦ba­È¡A·Ð½Ð¦U¦ì¤j¤jÀ°¦£¡A·PÁ¡C

ÀÉ®×-1.zip (73.13 KB)

¦U¦ì¤j¤j..°ÝÃD¤j­P³B²z¦n¤F¡A¤£°_·N«ä¥´ÂZ¦U¦ì¡C
¥Dµ{¦¡
Private Sub CommandButton1_Click()
Dim a As Integer
    Call aa
End Sub

°Æµ{¦¡
Sub aa() 'Function aa()      '¥»°êÄy¤@¯ë¡B¥~Äy°êÄy-¶V«n¡B¬Z´¶¹ë¡B¬Z´¶¹ë¡B®õ°ê¡Bµá«ß»«¡B¦L¥§¡B¨ä¥L

Dim strYear As String      'ÅܼÆ-²Î­pªº¦~¤ë

Dim strNo As String      'ÅܼÆ-®×¸¹ªº¦~¤ë

Dim strCountry As String 'ÅܼÆ-°êÄy

Dim intAmount As Integer      'ÅܼÆ-µ§¼Æ

Dim i, l, h, b, ii As Integer    'ÅܼÆ-Äæ ¦C

Dim j, w As Integer      'ÅܼÆ-²Î­p¼Æ



j = 0

w = 0


a = 57

While a < 72

b = a
c = b + 1
   
    intAmount = Application.CountA(Sheets("¨ü­hªÌ").Range("A2:A65535")) + 1      '¨úµ§¼Æ

    For h = b To c
    For l = 12 To 23
   
    Select Case h
        Case Is <= 58
            ii = 37
        Case Is <= 62
            ii = 41
        Case Is <= 64
            ii = 43
        Case Is <= 66
            ii = 45
        Case Is <= 68
            ii = 47
        Case Is <= 70
            ii = 49
        Case Is <= 72
            ii = 51
   
   
    End Select
   
    strYear = Application.WorksheetFunction.Text((Sheets("©u²Î­p").Cells(2, 3) & Sheets("©u²Î­p").Cells(5, l)), 0)
    strCountry = Application.WorksheetFunction.Text((Sheets("©u²Î­p").Cells(h, 3) & "-" & Sheets("©u²Î­p").Cells(h, 4)), 0)


      '¨ú¦~¤ë¥÷-©u²Î­p
            
        For i = 2 To intAmount
      
          strNo = Mid(Sheets("¨ü­hªÌ").Cells(i, 1), 3, 4)
            
            If strNo = strYear Then        '¦~¤ë¥÷-§PÂ_®×¸¹¬O§_µ¥©ó©u²Î­p
               
                If Sheets("¨ü­hªÌ").Cells(i, 4) = "¦¨®×" Then        '¦¨®×-§PÂ_®×¥ó¬O§_¦¨®×
                    
                    If Sheets("¨ü­hªÌ").Cells(i, h - ii) = strCountry Then      '¨ü­hªÌ¥»¨­¯S®íª¬ªp-§PÂ_¨ü­hªÌ¥»¨­¯S®íª¬ªp¬O§_Äݹê
                       j = j + 1
                  
                    End If
               
                End If
            
            End If
            
            w = j
            
        Next i
        
          j = 0

          Sheets("©u²Î­p").Cells(h, l).Value = w
    Next l
    Next h
   
  
  a = a + 2

Wend

End Sub

TOP

        ÀR«ä¦Û¦b : ¡i®É¶¡¦pÆp¥Û¡j®É¶¡¹ï¤@­Ó¦³´¼¼zªº¤H¦Ó¨¥¡A´N¦pÆp¥Û¯ë¬Ã¶Q¡F¦ý¹ï·M¤H¨Ó»¡¡A«o¹³¬O¤@§âªd¤g¡A¤@ÂI»ù­È¤]¨S¦³¡C
ªð¦^¦Cªí ¤W¤@¥DÃD