vba 删除空值的单元格,上移数据
Sub aa() Dim arr As Variant Dim i As Integer Dim j As Integer Dim rng As Range Dim temp As Variant arr = Range("a1", [a65536].End(3)).Value j = 1 For i = 1 To UBound(arr) If arr(i, 1) <> "" Then Worksheets("Sheet2").Cells(i, 1).Value = "" Worksheets("Sheet2").Cells(j, 1).Value = arr(i, 1) j = j + 1 End If Next End Sub