一个Excel里用的VBA,循环处理每个单元格,将分号分隔的内容倒过来

只是为了记录一下,下次备用

 

 

Sub TreatCell()
    Dim i, j, k
    Dim Ary
    Dim str
   
    For i = 2 To 38147
        For j = 2 To 11
            If InStr(Worksheets("Sheet3").Cells(i, j).Value, ";") > 0 Then
                str = ""
                Ary = Split(Worksheets("Sheet3").Cells(i, j).Value, ";")
                For k = UBound(Ary) To 0 Step -1
                    str = str + ";" + Ary(k)
                Next
                str = Mid(str, 2)
                Worksheets("Sheet3").Cells(i, j).Value = str
            End If
        Next
    Next
    MsgBox "处理完毕"
End Sub

posted @ 2010-11-04 18:51  阳光.创新  阅读(1129)  评论(0编辑  收藏  举报