- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¥»©«³Ì«á¥Ñ GBKEE ©ó 2012-2-16 08:20 ½s¿è
¦^´_ 1# baa168
¸Õ¸Õ¬Ý- Option Explicit
- Sub Ex()
- Dim xR As Integer, xMonth As Integer, Ar(), xAr As Integer
- xR = 4 '²Ä4¦C
- ReDim Ar(1, xAr) '«·s«Å§i AR(0 TO 1,0) ¤Gºû°}¦C
- Ar(0, xAr) = "¤é´Á" 'Ar(0, 0) = "¤é´Á"
- Ar(1, xAr) = "¤º®e" 'Ar(1, 0) = "¤º®e"
- With ActiveSheet
- xMonth = Month(.Cells(xR, "A")) '¨ú±o A4¤ë¥÷
- Do While .Cells(xR, "A") <> "" '°õ¦æ°j°é±ø¥ó ¤£¬OªÅ¥ÕªºÀx¦s®æ
- If Month(.Cells(xR + 1, "A")) <> xMonth Or .Cells(xR + 1, "A") = "" Then
- '¤U¤@¦Cªº¤ë¥÷<>³o¤@¦Cªº¤ë¥÷ ©Î¬O ¤U¤@¦C¬OªÅ¥Õ
- xMonth = Month(.Cells(xR + 1, "A")) '§ó§ï¤ë¥÷ªº¼ÆÈ
- xAr = xAr + 1 '¤Gºû°}¦C ªº²Ä¤Gºû¦A¥[¤@Ó¤¸¯À
- ReDim Preserve Ar(1, xAr) '«·s«Å§i AR(0 TO 1,xAr) ¤Gºû°}¦C
- 'Preserve ¿ï¾Ü©Ê¤Þ¼Æ¡C·í§ïÅÜ즳°}¦C³Ì«á¤@ºûªº¤j¤p®É¡A¤´µM«O¦³ì¨Óªº¸ê®ÆªºÃöÁä¦r¡C
- Ar(0, xAr) = .Cells(xR, "A") 'Ar(0, xAr) = "¤é´Á"
- Ar(1, xAr) = .Cells(xR, "B") 'Ar(0, xAr) = "¤º®e"
- End If
- xR = xR + 1 '¦A©¹¤U¤@¦C
- Loop
- .Range("G3").CurrentRegion = "" 'CurrentRegion Äݩʥثe°Ï°ì¬O«ü¥H¥ô·NªÅ¥Õ¦C¤ÎªÅ¥ÕÄ檺²Õ¦X¬°Ãä¬Éªº½d³ò¡C°ßŪ¡C
- .Range("G3").Resize(xAr + 1, 2) = Application.Transpose(Ar) '¹B¥Î¤u§@ªí¨ç¼Æ Transpose (Âà¸m) Ar °}¦C
- .Range("G3").Resize(xAr + 1).NumberFormatLocal = "m/d;@" ' ¨îqÀx¦s®æ ¤é´Á®æ¦¡
- End With
- End Sub
½Æ»s¥N½X |
|