删除范围内的空白单元格 [英] Delete blank cells in range

查看:113
本文介绍了删除范围内的空白单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要删除范围为(E1:E130)的空白单元格。

I want to delete blank cells in a range (E1:E130).

此代码跳过单元格。

For Each cell In ranger
    If cell.Value = "" Then
        cell.Delete
    End If
next cell

为了更清楚地说明我的目标:我有一个单元格列表,其中包含文本和E1范围内的空单元格: E130和我想从E1开始列出一个没有任何空单元格的列表。

例如,对字母进行排序也是一个很好的解决方案,但是对我来说也不可行。

To make my objective more clear: I have a list of cells with text and empty cells in the range E1:E130 and I want to make a list starting on E1 without any empty cells.
Sorting on alphabet for instance would also be a good solution, however that didn't work out for me either.

推荐答案

我将按照以下步骤进行操作

I'd go like follows

With Range("E1:E130")
    If WorksheetFunction.CountA(.Cells) > 0 Then .SpecialCells(xlCellTypeBlanks).Delete Shift:=xlShiftUp
End With

这篇关于删除范围内的空白单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆