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

VBA ·í2­Ó±ø¥ó¤@¼Ë®É¡A¦Û°Ê´M§ä¿é¤J 2

VBA ·í2­Ó±ø¥ó¤@¼Ë®É¡A¦Û°Ê´M§ä¿é¤J 2

·í¤u§@ªí¤W¦³"¨®½ø½s¸¹"A201603030015©M"¥q¾÷(1)"¶ÂªQ©M"¥q¾÷(2)"¶ÂªQ®É¡A³o¥Nªí¥L¤w¸g°e³f¦^¨Ó¤F¡A¦ý¦]¬°¥L¦b¤£¦P¼Ëªº®É¶¡¤S¥X¥h°e³f¡A©Ò¥HÁÙ­n¦A¦¸¿é¤J"¨®½ø½s¸¹"A201603030015©M"¥q¾÷(1)"¶ÂªQ¡A³o­Ó¸ê®ÆÁÙ­n¨Ì§Ç¦bAÄæ©MBÄæ¤WÂà¼g¡A·í¥L¤S°e³f§¹¦^¨Ó®É¡A¤S­n¦^¨ì¥u¯à¦bCÄæ²£¥ÍBÄæ¹ïÀ³ªº¸ê®Æ¡A(·s¼WFÄ欰TextBox3 ©Ò¶ñ¤Jªº¸ê®Æ)¤]¸òµÛ¦^¨®¿é¤J¶i¥h¡A³Â·Ð¦Ñ®v¦b¶O¤ß¤F¡AÁÂÁÂ!
ÂÐÀÉ: 20160331.rar (26.25 KB)

¥»©«³Ì«á¥Ñ luhpro ©ó 2016-4-2 23:58 ½s¿è

¦^´_ 1# man65boy
[Module]
  1. Public lRows&
  2. Public vDIO, vDPeo
½Æ»s¥N½X
[Sheet ¥D­¶]
  1. Private Sub cbInput_Click()
  2.   UserForm1.Show
  3. End Sub
½Æ»s¥N½X
[ThisWorkbook]
  1. Private Sub Workbook_Open()
  2.   Dim lRow&
  3.   Dim sStr$
  4.   
  5.   Set vDIO = CreateObject("Scripting.Dictionary")
  6.   Set vDPeo = CreateObject("Scripting.Dictionary")
  7.   lRow = 2
  8.   While Cells(lRow, 1) <> ""
  9.     If Cells(lRow, 3) = "" Then
  10.       sStr = "O"
  11.     Else
  12.       sStr = "I"
  13.     End If
  14.     vDIO(CStr(Cells(lRow, 1) & "-" & Cells(lRow, 2))) = sStr
  15.     vDPeo(CStr(Cells(lRow, 1) & "-" & Cells(lRow, 2))) = lRow
  16.     lRow = lRow + 1
  17.   Wend
  18.     lRows = lRow - 1
  19. End Sub
½Æ»s¥N½X
[UserForm]
  1. Private Sub CommandButton1_Click()
  2.   Dim lRow&
  3.   
  4.   If TextBox1 = "" Then
  5.     MsgBox "§A¥²¶·¿é¤J (¨®½ø½s¸¹)"
  6.     Exit Sub
  7.   End If
  8.   
  9.   If TextBox2 = "" Then
  10.     MsgBox "§A¥²¶·¿é¤J (¥q¾÷¤H­û)"
  11.     Exit Sub
  12.   End If
  13.   
  14.   lRow = vDPeo(CStr(TextBox1 & "-" & TextBox2))
  15.   If vDIO(CStr(TextBox1 & "-" & TextBox2)) = "O" Then ' ¦^¨Ó¤F
  16.     Cells(lRow, 3) = TextBox2
  17.     Cells(lRow, 5) = Now
  18.     Cells(lRow, 6) = ComboBox1.Text
  19.     vDIO(CStr(TextBox1 & "-" & TextBox2)) = "I"
  20.   Else ' §Y±N¥~¥X
  21.     lRows = lRows + 1
  22.     Cells(lRows, 1) = TextBox1
  23.     Cells(lRows, 2) = TextBox2
  24.     Cells(lRows, 4) = Now
  25.     vDIO(CStr(TextBox1 & "-" & TextBox2)) = "O"
  26.     vDPeo(CStr(TextBox1 & "-" & TextBox2)) = lRows
  27.   End If
  28. End Sub

  29. Private Sub UserForm_Initialize()
  30.   ComboBox1.AddItem "NO"
  31.   ComboBox1.AddItem "Yes"
  32.   ComboBox1.ListIndex = 0
  33. End Sub
½Æ»s¥N½X
½Ð¯d·N : ¥D­¶ ªº ¿é¤J«ö¶s §Ú¦³­««Ø¦¨ cbInput «ö¶sª«¥ó

20160331-A.zip (24.93 KB)

TOP

¦^´_ 2# luhpro

·PÁÂluhpro¦Ñ®vªºµªÂСA§¹¬ü¦n¹ê¥Î¡A¯uªº«ÜÁÂÁÂ!

TOP

        ÀR«ä¦Û¦b : ¦Û¤v®`¦Û¤v¡A²ö¹L©ó¶ÃµoµÊ®ð¡C
ªð¦^¦Cªí ¤W¤@¥DÃD