- ©«¤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
|
¦^´_ 1# lionliu
¸Õ¸Õ¬Ý- Option Explicit
- Sub Ex()
- Dim Rng As Range, i As Integer, Msg As Boolean
- Set Rng = Sheets(1).[A2]
- With Sheets(2)
- .UsedRange.Clear '.UsedRangeªº½d³ò < .Cellsªº½d³ò,³B¸Ì³t«×·|§Ö¨Ç
- .Range("a1").Resize(, 4) = Array("Description", "Qty", "Price", "Amount") '¤@°_µ¹È
- i = 2 '³]©w°_©lÈ
- Do While Rng <> "" 'Rng ="" °j°é°±¤î
- If Msg = False Then
- .Cells(i, "A") = Rng.End(xlUp) & ": " & Rng
- i = i + 1
- End If
- .Cells(i, "A") = Rng.Cells(1, 2).End(xlUp) & ": " & Rng.Cells(1, 2) 'item no
- .Cells(i, "B").Resize(, 3) = Rng.Cells(1, 4).Resize(, 3).Value 'qty,price, amount
- .Cells(i + 1, "A") = Rng.Cells(1, 3) 'Description
- i = i + 2
- Msg = False '³] po no ¤£¬Û¦P
- If Rng = Rng.Offset(1) Then Msg = True 'po no ¬Û¦P
- Set Rng = Rng.Offset(1) '¤U²¾¤@¦C
- Loop
- End With
- End Sub
½Æ»s¥N½X |
|