ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ¦p¦ó§Q¥ÎWrapTextÄݩʨüW¥[Chr(10)

[µo°Ý] ¦p¦ó§Q¥ÎWrapTextÄݩʨüW¥[Chr(10)

¥»©«³Ì«á¥Ñ dechiuan999 ©ó 2012-5-10 09:06 ½s¿è

¦U¦ì¤j¤j¦n¡G
¦b«ü©wªºRangeÄæ

WrapText.rar (7.88 KB)

¦^´_ 1# dechiuan999 [code]Option Explicit

Sub aa()
   
    Dim mSht1 As Worksheet
    Dim mRng As Range, mRng1 As Range, i%, Mystr$
   
    Set mSht1 = Worksheets(1)
    With mSht1
        Set mRng = .Range("a1:a7")
        .Columns("i").ColumnWidth = 10
        For Each mRng1 In mRng
        Mystr = mRng1.Value
        For i = 2 To Len(Mystr) - Len(Replace(Mystr, " ", ""))  '²Ä¤G­Ó¥H«áªºªÅ¥ÕÁä¶}©l¨ú¥N
            Mystr = Application.Substitute(Mystr, " ", Chr(10), i)
        Next
            mRng1.Offset(, 8).Value = Mystr
            mRng1.Offset(, 8).WrapText = True     '§Q¥ÎWrapTextÄÝ©Ê
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

ÁÂÁª©¥D¤j¤j¡C

¥¿²Å¦X¤p§Ìªº¶·¨D¡C
·P®¦ª©¥D¤j¤j¡C

TOP

¥»©«³Ì«á¥Ñ icestormer ©ó 2012-5-11 08:43 ½s¿è

¦^´_ 3# dechiuan999

§Ú§â¶Wª©ªºµ{¦¡¤p¤p§ï¤F¤G­Ó¤p¦a¤è«á ©~µM·|¥X²{ ¥u­n¹J¨ìªÅ®æ´N·|Â_¦æ¤F
,³o¬O¤@Ãä¾Ç²ß¶Wª©´£¨Ñªºµ¹§Aªºµ{¦¡½X¤¤(substituteÁÙ¬O­è¤~¥h¬d¤~ª¾¹D¨º¬O¤°»ò§@¥Î.)¤£¤p¤ß¸Õ¥X¨Óªº

­ì¥»¶Wª©ªº·|¦b²Ä¤G­ÓªÅ®æ«á¤~·|Â_¦æ §ï¦¨¤U¤è«á·|±q²Ä¤@­ÓªÅ®æ´N¶}©lÂ_¤F,¤£ª¾³o¬O¤£¬O§A­nªº
    Sub aa()
   
    Dim mSht1 As Worksheet
    Dim mRng As Range, mRng1 As Range, i%, Mystr$
   
    Set mSht1 = Worksheets(1)
    With mSht1
        Set mRng = .Range("a1:a7")
        .Columns("i").ColumnWidth = 10
        For Each mRng1 In mRng
              Mystr = mRng1.Value

            For i = 0 To Len(Mystr) - Len(Replace(Mystr, " ", ""))   '³o¸Ì°j°é¤]¥Ñ2§ï¬°0¶}©l
          ' For i = 2 To Len(Mystr) - Len(Replace(Mystr, " ", ""))   '²Ä¤G­Ó¥H«áªºªÅ¥ÕÁä¶}©l¨ú¥N
                             Mystr = Application.Substitute(Mystr, " ", Chr(10)) '¸ò¶Wª©ªº¥u¦³®t¦b³o¸Ì¤Ö¤@ "i"
                            ' Mystr = Application.Substitute(Mystr, " ", Chr(10), i)
            Next
                            mRng1.Offset(, 8).Value = Mystr
                           mRng1.Offset(, 8).WrapText = True     '§Q¥ÎWrapTextÄÝ©Ê<<<<  ¤£¹L³o¸Ì¦³¤@­Ó°ÝÃD §Ú¸Õ¹L¤£ºÞ¦³¨S¦³³o¦æ ,«ç¬Ý°_¨Ó®ÄªG¤@¼Ë©O?
        Next '
   End With
        
End Sub

TOP

¦^´_ 4# icestormer


    Substitute¨ç¼Æ¡A«ü©w³Ì«á¤@­Ó¤Þ¼Æ¤~¯à°w¹ï¸Ó¦r¤¸§@¨ú¥N
©¿²¤¸Ó¤Þ¼Æ«h¬O¥þ³¡¨ú¥N
©Ò¥H§A©¿²¤¨º­Ó i ´N¤£¥²¨Ï¥Î°j°é¡A¥i¥H¤@¦¸¥þ³¡¨ú¥N
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 5# Hsieh


   ­ì¨Ó¦p¦¹. ¨ü±Ð¤F

TOP

        ÀR«ä¦Û¦b : ªY½à§O¤H´N¬O²øÄY¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD