对齐数据单元格值公式
Align data cell value formula
我想知道是否有可用的公式或方法来代替手动拖动单元格。
我的数据是这样的:
我应该得到的就是上面这个。
有什么可行的方法吗?而不是一个一个地拖动单元格?我有大量的数据。很高兴有任何解决方案。非常感谢!
您可以试试下面的代码,它会删除空单元格。
(前提是您将搜索范围更改为所需)
Sub Del_Empty_cells()
Dim cell, del, searchRng As Range
Set searchRng = Range("A1:B10")
Set del = Nothing
For Each cell In searchRng.Cells
If cell = 0 Or cell = "" Then
If del Is Nothing Then
Set del = cell
Else
Set del = Application.Union(del, cell)
End If
End If
Next cell
If Not del Is Nothing Then del.Delete
End Sub
我想知道是否有可用的公式或方法来代替手动拖动单元格。
我的数据是这样的:
我应该得到的就是上面这个。
有什么可行的方法吗?而不是一个一个地拖动单元格?我有大量的数据。很高兴有任何解决方案。非常感谢!
您可以试试下面的代码,它会删除空单元格。 (前提是您将搜索范围更改为所需)
Sub Del_Empty_cells()
Dim cell, del, searchRng As Range
Set searchRng = Range("A1:B10")
Set del = Nothing
For Each cell In searchRng.Cells
If cell = 0 Or cell = "" Then
If del Is Nothing Then
Set del = cell
Else
Set del = Application.Union(del, cell)
End If
End If
Next cell
If Not del Is Nothing Then del.Delete
End Sub