2017-03-16 41 views

回答

0

下面是一个例子,让你开始。

此代码将带您都强调活动单元格,并打破了由空格串,行扩大其跨列1.

例子:

  1. 单元格A5包含的“Hello World测试”
  2. 亮度小区A5
  3. 调用子
  4. 的代码将执行,并立即将在A2“你好”的A1,“世界”和“测试”中A3

    Sub Example() 
        Dim txt As String 
        Dim i As Integer 
        Dim fullname As Variant 
    
        txt = ActiveCell.Value 
        fullname = Split(txt, " ") 
        For i = 0 To UBound(fullname) 
         Cells(1, i + 1).Value = fullname(i) 
         MsgBox fullname(i) 
        Next i 
    End Sub 
    
相关问题