原始数据

q q   ddd   qc
b   bff b   bsf
b       bww bcvb
cee         cff

VBA运行后
q q ddd qc    
b bff b bsf    
b bww bcvb      
cee cff
       
要求处理的数据区域是动态的

解决方案 »

  1.   

    Sub a()
        Dim i As Long, j As Long
        i = 1
        While i <= [A65530].End(xlUp).Row
            j = 1
            While j <= Range("IV" & i).End(xlToLeft).Column
                If Len(Cells(i, j)) = 0 Then
                    Cells(i, j).Delete xlShiftToLeft
                Else
                    j = j + 1
                End If
            Wend
            i = i + 1
        Wend
    End Sub