- ©«¤l
- 1447
- ¥DÃD
- 40
- ºëµØ
- 0
- ¿n¤À
- 1471
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Excel 2010 & 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2020-7-15
- ³Ì«áµn¿ý
- 2024-11-29
|
ÁÂÁ¦U¦ì«e½ú
'Âà©À!
'1.±q¸ê®Æ®w¸Ì±a¥X»Ýnªº¸ê®Æ¬d¬Ý©Î´N¥i¥H¤F!
'¤£¥²n¸ê®Æ®w¥þ³¡±a¥X¸ê®Æ¤W¤F©³¦â,¦A¿z¿ï»Ýnªº¸ê®Æ
'2.¬°¤F¬d¬Ý¨Ï¥Î¦Ó¤W¦â!¨S¦³¥²n¬°¤W¦â¦Ó¤W¦â
'3.¦Ü©ó¦pªG¬O¬°¤F½s¿è¸ê®Æ,¦Ó¥u±a¥X¸ê®Æ®w¤Ö³¡¤À¸ê®Æ!
'´N½m¦n§Þ¯à,«öÓ¶s±N¦³½s¿èªº¸ê®Æ§Ö³t¤Ï±a¦^¸ê®Æ®w´N¦n¤F
¥H¤U¤ß±oµù¸Ñ½Ð¦U¦ì«e½ú«ü¥¿¨Ã«ü¾É!ÁÂÁÂ
Option Explicit
Sub ¤Ï¦V±aÈ_¤W¦â_Detail()
Dim Arr, R&, C%, Sh, Shu, reg, Find_Num, i&
Dim x%, y%, Z&, T
'¡ô«Å§iÅܼÆ
T = Timer
Z = 200
'¡ô³]©w·Qn¬d¬Ý¸ê®Æªº²Ó³¡±ø¥ó
Set Sh = Sheets("¾Þ§@ªí")
'¡ô¥OSh ¬O¤u§@ªí
Set Shu = Sheets("¤Ï¾Þ§@ªí")
'¡ô¥OShu ¬O¤u§@ªí
Sh.UsedRange.EntireRow.Delete
'¡ô¾Þ§@ªí ¦³¨Ï¥Îªº¦C¥þ³¡§R°£
R = Shu.UsedRange.EntireRow.Rows.Count
'¡ô¥OR¬O ¤Ï¾Þ§@ªí¦³¨Ï¥Îªº¦C¼Æ
C = Shu.UsedRange.EntireColumn.Columns.Count
'¡ô¥OC¬O ¤Ï¾Þ§@ªí¦³¨Ï¥ÎªºÄæ¼Æ
Set reg = CreateObject("VBScript.RegExp")
'¡ô¥Oreg ¬O¥¿«h
reg.Pattern = "\d+"
'¡ô¥¿«hªº³W«h¬O³Q«D¼Æ¦r¶¡¹jªº¼Æ¦r¦ê
reg.Global = True
'¡ô¥¿«h«áªº¸ê®Æ¥þ³¡³£n!
For x = 2 To C Step 2
'¡ô³]¥~¶¶°j°é! ±q2 ¨ì ¤Ï¾Þ§@ªí¦³¨Ï¥ÎªºÄæ¼Æ,¨C¦¸Â¶¦^¨Óx+2
For y = 3 To R
'¡ô³]¤º¶¶°j°é! ±q2 ¨ì ¤Ï¾Þ§@ªí¦³¨Ï¥Îªº¦C¼Æ
Set Find_Num = reg.Execute(Shu.Cells(y, x))
'¡ô¥OFind_Num ¬O°j°éÀx¦s®æ°õ¦æ¥¿«h¤§«áªº°}¦C
If Find_Num.Count > 0 Then
'¡ô¦pªG Find_Num°}¦C¸Ì¦³¸ê®Æ??
If Find_Num(0) Mod Z = 0 Then
'¡ô¦pªG Find_Num°}¦C¸Ìªº²ÄӼƦr °£¥H200ªº¾l¼Æ¬O0(¾ã°£ªº·N«ä)
Sh.Cells(Find_Num(0) / Z, Find_Num(1)).Interior.ColorIndex = _
Shu.Cells(1, x + 1).Interior.ColorIndex
'¡ô¾Þ§@ªí¬Û¹ïÀ³ªºÀx¦s®æ¦ì¸m¤W©³¦â
Sh.Cells(Find_Num(0) / Z, Find_Num(1)) = Shu.Cells(y, x + 1)
'¡ô¾Þ§@ªí¬Û¹ïÀ³ªºÀx¦s®æ¦ì¸m¿é¤JÈ
End If
End If
Next
Next
Sh.Activate
MsgBox Timer - T & " ’"
End Sub |
|