- ©«¤l
- 1446
- ¥DÃD
- 40
- ºëµØ
- 0
- ¿n¤À
- 1470
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Excel 2010 & 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2020-7-15
- ³Ì«áµn¿ý
- 2024-10-21
|
¥»©«³Ì«á¥Ñ Andy2483 ©ó 2022-10-4 09:38 ½s¿è
¦^´_ 14# jackyliu
¾Ç²ß¤ß±o¦p¤U¨Ñ«e½ú°Ñ¦Ò
¤]½Ð¦U¦ì«e½ú«ü¥¿!ÁÂÁ¦U¦ì«e½ú!
Option Explicit
Sub ·j´MÃöÁä¦r() '¡÷¡ô¡ö¡õ
Application.ScreenUpdating = False
'¡ô°õ¦æ®É¿Ã¹õµe±¤£n¸òµÛÅÜ°Ê
Dim Arr, Brr, Crr, i, x, d, xD, T, q$, f$, n, xA, s, v, SD, SS&
'¡ô«Å§iÅܼÆ
T = Timer
'¡ô¥OT=²{¦b®É¶¡
Set xA = Sheets("ÃöÁä¦r").Cells
'¡ôxA=ÃöÁä¦rªº©Ò¦³Àx¦s®æ
Set xD = CreateObject("Scripting.Dictionary")
'¡ô¥OxD ¬O¦r¨å
SD = Array(, 1, 4, 7, 10, 13, 16) '@@
'¡ô¥OSD¬O¤@ºû°}¦C
For s = 1 To Columns.Count Step 2
'¡ô³]©w°j°és±q 1 ¨ì¾ãÓ¤u§@ªíªº³Ì«á¤@Äæ,¨C¶¦^¨Ó¤@¦¸sn+2
If xA(1, s) = "" Then
'¡ô·í²Ä1¦CªºsÄæ¬OªÅ®æ!
GoTo 101
'¡ô±ø¥ó¦¨¥ß´N¸õ¨ì 101 ªº¼Ð¥Ü¦ì¸m
End If
SS = (s + 1) / 2
'¡ô¥OSS ¬On«ü¦V SD°}¦C ªº¦ì¸m,·ís¬O1®ÉSS=1,¬O«ü¦V¤W¤è@@ªº1
'¡ô,·ís¬O3®ÉSS=3,¬O«ü¦V¤W¤è@@ªº4
Arr = Range(Cells(2, SD(SS)), Cells(Rows.Count, SD(SS)).End(3))
'¡ô§âÀx¦s®æÈˤJ Arr°}¦C ¸Ì
'¡ô·ís¬O1®É,Arr°}¦C ¸Ì©ñªº¬O[A2:A101]
ReDim Crr(1 To UBound(Arr), 1 To 1)
'¡ô«Å§i Crr°}¦Cªº¤j¤p!Áa¤è¦V¬O1 ¨ì(Arr°}¦CÁa¦V¼Æ¶q),¾î¤è¦V¬O1Äæ)
Brr = xA.Range(xA(1, s), xA(Rows.Count, s + 1).End(3))
'¡ô§âÀx¦s®æÈˤJ Brr°}¦C ¸Ì
'¡ô·ís¬O1®É,¨ì¶i¥hªº¬OSheets("ÃöÁä¦r").[A1:B10]
xD.RemoveAll
'¡ô²MªÅxD¦r¨å
For d = 2 To UBound(Brr)
'¡ô³]©w°j°é,±q2 ¨ì Brr°}¦CÁa¦V¼Æ¶q
xD(Brr(d, 1)) = Brr(d, 2)
'¡ô·íd=2 ¦r¨åªºkey="ABC",item="¤W¤WÅÒ"
Next
For i = 1 To UBound(Arr)
'¡ô³]©w°j°é,±q1 ¨ì Arr°}¦CÁa¦V¼Æ¶q
For Each x In xD.Keys
'¡ô¥Ox¬O¦r¨å¸Ìªº¤@¤À¤l,°j°é±q¦r¨å¸Ìªº²Ä1Ókey¶}©l¹B¥Î
',¨C¶¦^¨Ó´NÅܦ¨²Ä2Ókey.....
q = UCase(Arr(i, 1))
'¡ô¥Oq¦r¦ê¬OArr°}¦CªºÈ(¥B¤p¼g^¤å¦r¥À³£Åܤj¼g),¨Ò¦p UCase("NHjoOa")="NHJOOA"
f = UCase(x)
'¡ô¥Of¦r¦ê¬OxD.Key(¥B¤p¼g^¤å¦r¥À³£Åܤj¼g)
n = Len(x)
'¡ô¥On¬OxD.Keyªº¦r¼Æ
If InStr(q, f) <> 0 Then
'¡ô¦pªGq¦r¦ê¸Ì¥]§t¤Ff¦r¦ê,f¦r¦ê¦bq¦r¦êªº²Ä´XÓ¦r¦ì¸m,¨Ò¦p InStr("ABCD", "CD")=3
Crr(i, 1) = xD(x)
'¡ô¦pªG¤W¤è±ø¥ó¦¨¥ß!´N¥OCrr°}¦C¸Ë¤J key¬Ox ªºitem xD(x)
Cells(i + 1, SD(SS)).Characters(InStr(q, f), n).Font.ColorIndex = 3
'¡ô¦pªG¤W¤è±ø¥ó¦¨¥ß!´N§â¦rÅܬõ¦â
Exit For
'¡ô¦pªG¤W¤è±ø¥ó¦¨¥ß!´N¸õ¥X (For Each x In xD.Keys)³oÓ°j°é
End If
Next
Next
v = Array(, 2, 5, 8, 11, 14, 17)(SS)
'¡ô¥Ov¬O¤@ºû°}¦C!¬O¥Î¨Ó«ü©wÃöÁä¦r©Ò·j´M¨ìªºÈn©ñþ¸Ì
Cells(2, v).Resize(UBound(Crr), 1) = Crr
'¡ô·ís=1®É §âCrrˤJ¤u§@ªí[B2:B101]
Cells(1, v) = Brr(1, 2)
'¡ô·ís=1®É [B1]="ÅÒ§O"
Next
101
MsgBox "¦@¯Ó®É: " & Timer - T
Application.ScreenUpdating = True
'¡ô¿Ã¹õµe±«ì´_ÅÜ°Ê
End Sub |
|