- ©«¤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-7 16:21 ½s¿è
¦^´_ 5# cclo0728
ÁÂÁ«e½úµoªí¦¹¥DÃD»P½d¨Ò
«á¾Ç´£¨Ñ¥t¤@ºØ¤èªk¨Ñ«e½ú°Ñ¦Ò
¤µ¤Ñ²ß±o°}¦CˤJ¦r¨å»P¦Ü¦r¨å¤¤¨ú¥X°}¦C
½m²ß°}¦C»y¦r¨å
'§R°£µ²ªGªí¸ê®Æ!¦A±a¤J·s¸ê®Æ
Option Explicit
Sub test_A()
Dim Arr, T, xD, xA, xB
'¡ô«Å§iÅܼÆ
Set xD = CreateObject("Scripting.Dictionary")
'¡ô¥OxD¬O¦r¨å
Set xA = Sheets("¸ê®Æ¿é¤J")
'¡ô¥OxA¬O¤u§@ªí "¸ê®Æ¿é¤J"
Set xB = Sheets("¥X³f¸ê®Æ")
'¡ô¥OxB¬O¤u§@ªí"¥X³f¸ê®Æ"
T = xA.Cells(Rows.Count, 3).End(3).Row - 4
'¡ô¥OT¬O"¸ê®Æ¿é¤J"ªín±a¤J "¥X³f¸ê®Æ"ªíªº¦C¼Æ
Arr = xA.Cells(5, 2).Resize(T, 6)
'¡ô¨Ó·½ªí¸ê®ÆˤJArr°}¦C
xD(1) = Arr
'¡ôArr°}¦CˤJ¦r¨å
xD(2) = xA.Cells(2, 1)
'¡ô«È¤á¦WºÙˤJ¦r¨å
xD(3) = xA.Cells(2, 2)
'¡ô³æ¸¹Ë¤J¦r¨å
xB.UsedRange.Offset(1, 0).EntireRow.Delete
'¡ô¸ê®Æ§R°£
xB.[C2].Resize(UBound(Arr), 6) = xD(1)
'¡ô±a¥X°}¦C©ñ¤Jµ²ªGªí
xB.[A2].Resize(T, 1) = xD(2)
'¡ô±a¥X«È¤á¦WºÙ©ñ¤Jµ²ªGªí
xB.[B2].Resize(T, 1) = xD(3)
'¡ô±a¥X³æ¸¹©ñ¤Jµ²ªGªí
End Sub |
|