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

¦Û¦æ§PÂ_¤£²Å¦Xªº°}¦C¸ê®Æ¨Ã²¾°£¡C

¦Û¦æ§PÂ_¤£²Å¦Xªº°}¦C¸ê®Æ¨Ã²¾°£¡C

¦U¦ì¦n¡A°²³]¨Ï¥Î°}¦C¦s¤@§å¨­¤ÀÃÒ¡A¦ý¸Ì­±¦³´Xµ§¸ê®Æ¨Ã«D¨­¤ÀÃÒ¡A¬O§_¥i½ð°£«D¨­¥÷ÃÒªº¸ê®Æ¡A¨ä¥L¸ê°T¦Û°Ê¶ñ¸É¤W¥h¡H
Ä´¦p¡G
¥O°}¦CA0~A4¤À§O¬°
A0=A123456789
A1=B521632157
A2=A001
A3=A02
A4=S512935123
¦]¬°A2»PA3¬Ò«D¨­¤ÀÃÒ¦r¸¹¡A¥i§_­ç°£¤§«á¡A±N¸ê®Æ¦Û°Ê©¹¤W¶ñ¸É¡AÅܦ¨
A0=A123456789
A1=B521632157
A2=S512935123
·Ð½Ð½ç±Ð¡AÁÂÁ¡C

¦^´_ 1# tku0216
¨Ì·Ó¨­¤ÀÃÒ¦r¸¹³W«hÅçÃÒ
«D¦³®Ä¦r¸¹«h±Æ°£
¥Î¤@·s°}¦CÀx¦s¥¿½T¦r¸¹
  1. Option Explicit

  2. Sub ex()
  3. Dim A(0 To 4) As String, Ar() As String, i&, s&
  4. A(0) = "A123456789"
  5. A(1) = "B521632157"
  6. A(2) = "A001"
  7. A(3) = "A02"
  8. A(4) = "S512935123"
  9. For i = 0 To 4
  10.    If Pass(A(i)) Then
  11.       ReDim Preserve Ar(s)
  12.       Ar(s) = A(i)
  13.       s = s + 1
  14.    End If
  15. Next
  16. MsgBox Join(Ar, Chr(10))
  17. End Sub
  18. Function Pass(Mystr As String) As Boolean '¦r¸¹ÅçÃÒ
  19. Dim x, y%, k%, i%
  20. If Asc(Left(Mystr, 1)) < 65 Or Asc(Left(Mystr, 1)) > 90 Or Len(Mystr) <> 10 Then Pass = False: Exit Function
  21. k = Application.Match(Left(Mystr, 1), Array("A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "I", "O"), 0) + 9
  22. y = (k Mod 10) * 9 + Int(k / 10)
  23. x = Array(0, 0, 8, 7, 6, 5, 4, 3, 2, 1, 1)
  24. For i = 2 To Len(Mystr) - 1
  25.    y = y + Val(Mid(Mystr, i, 1)) * x(i)
  26. Next
  27. Pass = 10 - (y Mod 10) = Val(Right(Mystr, 1))
  28. End Function
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 2# Hsieh

ÁÂÁª©¥D¡A§Ú¬O·Q»¡VBA¬O§_¦³¨ä¥Lªº¤èªk¡A¥i¥HÅý°}¦C¼g¶i¥h¤§«á¡A­«·s¾ã²z¸Ó°}¦C¡AÅý¤£²Å¦X»Ý¨D(«DID)ªº¸ê®Æ²¾°£¡C
¤£¹L³o¤èªk¤]¥i¥H¡A¦hÁ¤À¨É~

TOP

        ÀR«ä¦Û¦b : ¹D¼w¬O´£ª@¦Û§Úªº©ú¿O¡A¤£¸Ó¬O¨þ¥¸§O¤HªºÃ@¤l¡C
ªð¦^¦Cªí ¤W¤@¥DÃD