- ©«¤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
|
¦^´_ 12# PJChen - Option Explicit
- Sub ¼t¯ÊText()
- Dim Rng As Range, M As Variant, W As Workbook, Sh As Worksheet, i As Integer
- Set W = Workbooks("³Ì·s®w¦s.xlsx")
- Set Sh = W.Sheets("¼t¯Êªí")
- '** §AÀɮתº¸ê®Æ¤£¾A¥Î 'Range.CurrentRegion ÄÝ©Ê ¶Ç¦^ Range ª«¥ó¡A¸Óª«¥ó¥Nªí¥Ø«eªº°Ï°ì¡C
- ** '¥Ø«e°Ï°ì¬O«ü¥H¥ô·NªÅ¥Õ¦C¤ÎªÅ¥ÕÄ檺²Õ¦X¬°Ãä¬Éªº½d³ò
-
- With Sh.Range("aw1").CurrentRegion
- Set Rng = Range(.Rows(2), .Rows(.Rows.Count)) '¨Ó·½°Ï°ì ¤£Åª¨ú²Ä1¦C,³]©w±q²Ä2¦C¶}©lŪ¨ú
- Rng.Cells(1, 5).Select
- MsgBox "§AÀɮפ£¾A¥Î CurrentRegionRng" & vbLf & Rng.Address(, , , 1, 1) & vbLf & Selection.Address(0, 0) & "¿ù»~È ³y¦¨µ{¿ù»~"
- End With
- M = "¼t¯ÊText" '³]©wM¬°±µ¦¬¸ê®ÆªºÅܼÆ,ªíÀY¬°""¤ºªº¤å¦r,¥i¥ô·N§ó§ï
- Set Rng = Sh.Range("aw2")
- Do Until Rng.Text = "" Or Rng.Text = 0 Or IsError(Rng)
- i = 1
- Do While Rng(i).Text <> "" And Rng(i).Text <> 0 And Not IsError(Rng(i))
- M = M & "," & Rng(i) '²ÄiÓ³B¦s®æ
- i = i + 1
- Loop
- Set Rng = Rng.Offset(, 1) '**¥ª²¾¤@Äæ
- Loop
- M = Split(M, ",")
- With Sh.Range("bm:bm") '±NŪ¨ú¸ê®Æ,Åã¥Ü¨ìBMÄæ
- .Clear
- .Resize(UBound(M) + 1) = Application.WorksheetFunction.Transpose(M)
- End With
- End Sub
½Æ»s¥N½X |
|