- ©«¤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 ©ó 2024-1-17 20:06 ½s¿è
ÁÂÁ½׾Â,ÁÂÁ¦U¦ì«e½ú
«á¾ÇÂǦ¹©«½Æ²ß¬Q¤Ñªº¤è®×,¤è®×¾Ç²ß¤ß±oµù¸Ñ¦p¤U,½Ð¦U¦ì«e½ú«ü±Ð
Option Explicit
Sub TEST()
Application.DisplayAlerts = False
'¡ô¥O¤£n¦A¸õ¥X¸ß°Ýµ¡(°Ý¯uªºn§R°£¤u§@ªí¶Ü?),ª½±µ§R¤F!
Dim Brr, R&, i&, j&, Nsht$, Sht, M
'¡ô«Å§iÅܼÆ
Sht = Application.InputBox("½Ð¿é¤J¾P¶×©Î¶i¶×", "¤u§@ªí¦WºÙ", "¾P¶×", , , , , 2)
'¡ô¥OShtÅܼƬO ¿é¤Jµ¡ªº¦^¶Çµ²ªG
If InStr("¾P¶×/¶i¶×", Sht) = 0 Then Exit Sub Else Nsht = Sht: Set Sht = Sheets(Sht)
'¡ô¦pªGInStr()¦^¶Ç ShtÅܼƤ£¥]§t¦b¦r¦ê¸Ì!´Nµ²§ôµ{¦¡,§_«h
'§_«h´N¥ONshtÅܼÆ(¦r¦ê)¬O shtÅܼÆÈ,¥OShtÅܼƬO¦W¬° ShtÅܼƪº¤u§@ªí
M = Application.InputBox("½Ð¿é¤J¤ë¥÷", "¤u§@ªí¦WºÙ", 3, , , , , 2)
'¡ô¥OMÅܼƬO ¿é¤Jµ¡ªº¦^¶Çµ²ªG
If Val(M) = 0 Then Exit Sub Else Nsht = Nsht & M & "¤ë"
'¡ô¦pªGInStr()¦^¶ÇÈÂà¤Æ¬°¼ÆÈ«á¬O 0!´Nµ²§ôµ{¦¡,§_«h
'§_«h¥ONshtÅܼƫᱦA³s±µ MÅܼÆ,¦A³s±µ "¤ë",¦¨¬°·s¦r¦ê
Brr = Range(Sht.[P1], Sht.[A65536].End(3))
'¡ô¥OBrrÅܼƬO ¤Gºû°}¦C,¥HShtÅܼÆ(¤u§@ªí)ªºA~PÄæÀx¦s®æȱa¤J°}¦C¤¤
For i = 1 To UBound(Brr)
'¡ô³]¶¶°j°é!
If Format(Brr(i, 2), "M") <> Val(M) And i <> 1 Then GoTo i01
'¡ô¦pªG²Ä2Äæ°}¦CÈ(¤é´Á)¤ë¥÷ ¤£¦P©óMÅܼÆÂà¤Æ¬°ªº¼ÆÈ,
'¦Ó¥BiÅܼƤ£¬O1,´N¸õ¨ì¼Ð¥Üi01ªº¦ì¸mÄ~Äò°õ¦æ
R = R + 1: For j = 1 To 16: Brr(R, j) = Brr(i, j): Next
'¡ô¥ORÅܼưO¿ýµ²ªG¸ê®Æn©ñ¦b²Ä´X¦C,
'³]¶¶°j°é,±Nµ²ªG¸ê®ÆÂл\±¼ì°}¦C¸ê®Æ,¼g¤J²Å¦X±ø¥óªº¸ê®Æ
i01: Next
On Error Resume Next
'¡ô¥Oµ{§Ç¹J¨ì¿ù»~¤£°±¤U¨Ó,Ä~Äò¶i¦æ¤UÓµ{§Ç
Sheets(Nsht).Delete
'¡ô¥O§R°£¦W¬° NshtÅܼƪº¤u§@ªí(¦pªG¨S¦³¦¹¤u§@ªí¥i§R°£,·|¸õ¹L)
With Worksheets.Add(after:=Worksheets(Sheets.Count))
'¡ô¥H¤U¬OÃö©ó¦b¯Á¤Þ³Ì«á·s¼W¤@Ó¤u§@ªíªºµ{§Ç
.Name = Nsht
'¡ô¥O¤u§@ªí¦W¦r¬O NshtÅܼƩұaªº¦r¦ê
.[A1].Resize(R, 16) = Brr
'¡ô¥O[A1]Àx¦s®æÂX®i¾A·í½d³ò¼g¤JBrr°}¦CÈ,¶W¹L¦¹½d³òªº°}¦CÈ©¿²¤
.Columns(2).NumberFormatLocal = "yyyy-m-d"
'¡ô¥OBÄæ®æ¦¡¨Ì·Ó³]©w¤è¦¡Åã¥Ü
.EntireColumn.AutoFit
'¡ô¥O³o½d³òÄæ¦ì¦Û°Ê½Õ¾ãÄæ¼e
End With
Erase Brr: Set Sht = Nothing
'¡ô¥OÄÀ©ñÅܼÆ
End Sub |
|