VBA ·í2Ó±ø¥ó¤@¼Ë®É¡A¦Û°Ê´M§ä¿é¤J
- ©«¤l
- 169
- ¥DÃD
- 39
- ºëµØ
- 0
- ¿n¤À
- 252
- ÂI¦W
- 0
- §@·~¨t²Î
- XP
- ³nÅ骩¥»
- 2003
- ¾\ŪÅv
- 20
- µù¥U®É¶¡
- 2011-4-17
- ³Ì«áµn¿ý
- 2020-7-17
|
VBA ·í2Ó±ø¥ó¤@¼Ë®É¡A¦Û°Ê´M§ä¿é¤J
¦bUserForm1¸Ì¡A1.¦b¨®½ø½s¸¹¤W¿é¤J½s¸¹«á¡A
2.¥q¾÷¤Hû¤S¿é¤J¤Hû½s¸¹«á¡A¦Û°Ê¨Ì§ÇÂà¼gUserForm1¸ê®Æ¦ÜA¡ABÄæ¡C
«ÂI:°²³]¤u§@ªí¤WA2¤w¿é¤JA201603030001¡AB2¤w¿é¤J¶ÂªQ¤F¡A§Ú¦A«ö¿é¤JUserForm1¸ÌÀY¡A¦b¦P¼Ë¿é¤J¨®½ø½s¸¹_A201603030001¡A¥q¾÷¤Hû_¶ÂªQ®É¡AC3n¶]¥XB2ªº¥q¾÷¤Hû(¶ÂªQ)¡A´N¬On¦Û°Ê¥h´M§ä·í2Ó±ø¥ó¤@¼Ë®É¡ACÄæÅã²{¹ïÀ³BÄ檺¥q¾÷¤Hû¦W¦r¡C
·PÁ¦ѮvÀ°¦£¸ÑÃD!
ªþÀÉ:
20160304.rar (178.74 KB)
|
|
|
|
|
|
|
- ©«¤l
- 1018
- ¥DÃD
- 15
- ºëµØ
- 0
- ¿n¤À
- 1058
- ÂI¦W
- 0
- §@·~¨t²Î
- win7 32bit
- ³nÅ骩¥»
- Office 2016 64-bit
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ®ç¶é
- µù¥U®É¶¡
- 2012-5-9
- ³Ì«áµn¿ý
- 2022-9-28
|
¥»©«³Ì«á¥Ñ stillfish00 ©ó 2016-3-4 16:55 ½s¿è
¦^´_ 1# man65boy
¦P¼ËAB¥X²{²Ä¤G¦¸¥H«á¡ACÄæ´N¸òBÄæ¤@¼Ë?
¬Ý¤£À´³o¼ËCÄæ ¥q¾÷¤Hû(2) ªº·N¸q¬OÔ£¡C
ÁÙ¦³§A¬On±qUserForm¿é¤JÁÙ¬O±q¤u§@ªí¿é¤J
§A±Ôz¹³¬O±qUserForm¡A¥i¬OÀɮ׬O§tWorksheet_Change(±q¤u§@ªí¿é¤J) |
|
ªí¹F¤£²M¡BÃD·N¤£©ú½T¡B¨SªþÀɮ׮榡¡B¨S¦³°Q½×°ÝÃDªººA«×~~~~~~¥H¤W·R²ö¯à§U¡C
|
|
|
|
|
- ©«¤l
- 169
- ¥DÃD
- 39
- ºëµØ
- 0
- ¿n¤À
- 252
- ÂI¦W
- 0
- §@·~¨t²Î
- XP
- ³nÅ骩¥»
- 2003
- ¾\ŪÅv
- 20
- µù¥U®É¶¡
- 2011-4-17
- ³Ì«áµn¿ý
- 2020-7-17
|
¥»©«³Ì«á¥Ñ man65boy ©ó 2016-3-5 11:46 ½s¿è
¦^´_ 2# stillfish00
¦^µªstillfish00¤j¤j¡A¬On±qUserForm¿é¤Jªº¡A¿é¤J«á«ö½T©w¡AÂà¼g¸ê®Æ¨ì¤u§@ªíªº¡C
¨Ì§ÇÂà¼g¨ì¤u§@ªí¤ñ¸û¨S°ÝÃD¡A§xÃøªº¬O·í§Ú¦A¶}±ÒUserForm¿é¤J®É¡A¿é¤Jªº¸ê®Æ¦pªG¸òA.BÄæ¤@¼Ë®É¡An¦bCÄæ²£¥Í©MBÄæ¤@¼Ëªº¸ê®Æ(¦ý¤£¯à§â¦bUserForm¿é¤Jªº¸ê®ÆÂà¼g)¡A¥u¯à¦bCÄæ°µ³B²z¡AÁÂÁ¦Ѯv̶O¤ß! |
|
|
|
|
|
|
- ©«¤l
- 522
- ¥DÃD
- 36
- ºëµØ
- 1
- ¿n¤À
- 603
- ÂI¦W
- 0
- §@·~¨t²Î
- win xp sp3
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-12-13
- ³Ì«áµn¿ý
- 2021-7-11
|
¸Õ¸Õ¬Ý:
Private Sub CommandButton1_Click()
Dim Lst As Integer, R As Integer
Dim Rng As Range, MH
Dim sh As Worksheet
Set sh = Sheets("¥D¶")
Lst = sh.[A65536].End(xlUp).Row '¨ú±o"¥D¶"ÄæA ³Ì¤U±«DªÅ¥Õ®æªº¦C¸¹
R = 1
Set Rng = sh.Range("A2:A" & Lst)
MH = Application.Match(TextBox1.Value, Rng, 0)
If Not Application.IsNumber(MH) Then GoTo 101: '¦pªGTextBox1ªº¸ê®Æ¤£¦bAÄ椤¡÷·s¼W
R = R + MH
If Range("B" & R) = TextBox2.Value Then '§_«h,¤ñ¹ïTextBox2»PBÄæ
' If Range("C" & MH) <> "" Then GoTo 101: '??¦pªGCÄæ«DªÅ¥Õ®æ¡÷n¤£n·s¼W??
Range("C" & R) = TextBox2.Value '§_«hCÄ欰ªÅ¥Õ®æ¡÷CÄæ=BÄæ
Exit Sub '§Y ¥q¾÷¤Hû(2)=¥q¾÷¤Hû(1)
End If
'«ÂФW¦C°Ê§@, ª½¨ì R+1>Lst
Do
Set Rng = sh.Range("A" & R + 1 & ":A" & Lst)
MH = Application.Match(TextBox1.Value, Rng, 0)
If Not Application.IsNumber(MH) Then GoTo 101:
R = R + MH
If Range("B" & R) = TextBox2.Value Then
Range("C" & R) = TextBox2.Value
Exit Sub
End If
Loop Until R + 1 > Lst
101:
'·s¼W¤@¦C¸ê®Æ
Range("A" & Lst + 1) = TextBox1.Value
Range("B" & Lst + 1) = TextBox2.Value
End Sub |
|
|
|
|
|
|
- ©«¤l
- 169
- ¥DÃD
- 39
- ºëµØ
- 0
- ¿n¤À
- 252
- ÂI¦W
- 0
- §@·~¨t²Î
- XP
- ³nÅ骩¥»
- 2003
- ¾\ŪÅv
- 20
- µù¥U®É¶¡
- 2011-4-17
- ³Ì«áµn¿ý
- 2020-7-17
|
¦^´_ 4# yen956
ÁÂÁÂyen956¦Ñ®vªº¦^µª¡A¯uªº¬O¤Ó¼F®`¤F¡Aèè¸Õ¤F´X¦^³£¨S¬Æ»ò°ÝÃD¡A¥u³Ñ¤U¤p§Ìªí¹FÁÙ¦³¤£°÷§¹µ½ªº¦a¤è¡AÀµ½Ð¦Ñ®v¦bÀ°¦£¡A¨Ò¦p:·í¤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¤Sn¦^¨ì¥u¯à¦bCÄæ²£¥ÍBÄæ¹ïÀ³ªº¸ê®Æ¡A³Â·Ð¦Ñ®v¦b¶O¤ß¤F¡AÁÂÁÂ! |
|
|
|
|
|
|
- ©«¤l
- 522
- ¥DÃD
- 36
- ºëµØ
- 1
- ¿n¤À
- 603
- ÂI¦W
- 0
- §@·~¨t²Î
- win xp sp3
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-12-13
- ³Ì«áµn¿ý
- 2021-7-11
|
¦^´_ 5# man65boy
©êºp, ¦Ò¼{¤[©P, Ó𦨤£«K! ©¯¦n¦³¶Wª©ªº±Ï´©!! |
|
|
|
|
|
|
- ©«¤l
- 2833
- ¥DÃD
- 10
- ºëµØ
- 0
- ¿n¤À
- 2889
- ÂI¦W
- 0
- §@·~¨t²Î
- ¡e²¤¡f
- ³nÅ骩¥»
- ¡e²¤¡f
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¡e²¤¡f
- µù¥U®É¶¡
- 2013-5-13
- ³Ì«áµn¿ý
- 2024-11-17
|
Private Sub CommandButton1_Click()
Dim xNo$, xName$, xR As Range
xNo = TextBox1: xName = TextBox2¡@
For Each xR In Range([A2], [A65536].End(xlUp))
¡@¡@If xR = xNo And xR(1, 2) = xName And xR(1, 3) = "" Then
¡@¡@¡@¡@xR(1, 3) = xName: xR(1, 5) = Now: Exit Sub
¡@¡@End If
Next
[A65536].End(xlUp)(2).Resize(1, 4) = Array(xNo, xName, "", Now)
End Sub
¢°¡D³Ì¦n¦b«e±¥[¤JÀË¿ù¡G
¡@¡@¡e½s¸¹¡f¨î¡e^¤j¼g¡f+¼Æ¦r¢°¢±½X
¡@¡@¡@If Not xNo Like "[A-Z]############" Then MsgBox "½s¸¹¿ù»~©Î¥¼¿é¤J!": Exit Sub
¡@¡@¡@If xName = "" Then MsgBox "¥q¾÷¦W¥¼¿é¤J!": Exit Sub
¢±¡D¨¾¿ù¬O¢ä¢Ð¢Ï³Ì«nªº¡A«Øij¡e¥X¨®¡f»P¡e¦^¨®¡f¤À§O¨âÓ«ö¶s°õ¦æ¡A
¡@¡@§_«hY½s¸¹©Î©m¦W¿é¤J¤@¦r¤§®t¡A¥»¨Ó¬O¦^¨®Åܦ¨¥X¨®¡I |
|
|
|
|
|
|
- ©«¤l
- 2833
- ¥DÃD
- 10
- ºëµØ
- 0
- ¿n¤À
- 2889
- ÂI¦W
- 0
- §@·~¨t²Î
- ¡e²¤¡f
- ³nÅ骩¥»
- ¡e²¤¡f
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¡e²¤¡f
- µù¥U®É¶¡
- 2013-5-13
- ³Ì«áµn¿ý
- 2024-11-17
|
¡e¥X¨®¡f¡e¦^¨®¡f¤À§O³B²z¡G
- Dim xChk&
- ¡@
- Private Sub CommandButton1_Click()
- xChk = 1: Call °O¿ý
- End Sub
- ¡@
- Private Sub CommandButton2_Click()
- xChk = 2: Call °O¿ý
- End Sub
- ¡@
- Sub °O¿ý()
- Dim xNo$, xName$, xR As Range
- xNo = TextBox1: xName = TextBox2
- If Not xNo Like "[A-Z]############" Then MsgBox "½s¸¹¿ù»~©Î¥¼¿é¤J!": Exit Sub
- If xName = "" Then MsgBox "¥q¾÷¦W¥¼¿é¤J!": Exit Sub
- For Each xR In Range([A2], [A65536].End(xlUp))
- ¡@¡@If xR = xNo And xR(1, 2) = xName And xR(1, 3) = "" Then
- ¡@¡@¡@¡@If xChk = 1 Then MsgBox "¥»¨®¦¸©|¥¼¦^¨®¡A½Ð½T»{!": Exit Sub
- ¡@¡@¡@¡@If xChk = 2 Then xR(1, 3) = xName: xR(1, 5) = Now: Exit Sub
- ¡@¡@End If
- Next
- If xChk = 1 Then [A65536].End(xlUp)(2).Resize(1, 4) = Array(xNo, xName, "", Now): Exit Sub
- If xChk = 2 Then MsgBox "§ä¤£¨ì¥»¨®¦¸ªº¥X¨®°O¿ý!": Exit Sub
- End Sub
½Æ»s¥N½X
¡@
°Ñ¦ÒÀÉ¡G
20160304_v1.rar (179.28 KB)
|
|
|
|
|
|
|
- ©«¤l
- 169
- ¥DÃD
- 39
- ºëµØ
- 0
- ¿n¤À
- 252
- ÂI¦W
- 0
- §@·~¨t²Î
- XP
- ³nÅ骩¥»
- 2003
- ¾\ŪÅv
- 20
- µù¥U®É¶¡
- 2011-4-17
- ³Ì«áµn¿ý
- 2020-7-17
|
¥»©«³Ì«á¥Ñ man65boy ©ó 2016-3-6 13:14 ½s¿è
¦^´_ 6# Hsieh
ÁÂÁÂHsiehªO¤jªº¦^µª¡A«D±`ªº¾A¥Î¡A¤p§Ì·|¥[¥HÀ³¥Î¦¬ÂáA·P®¦¦b¤ß! |
|
|
|
|
|
|