简体   繁体   English

清除列中所有等于“”的单元格

[英]Clear all cells in column who = “”?

So, I have a script that is plotting data points for me, and I'm running into an issue where there are several blank spots in the data. 因此,我有一个脚本正在为我绘制数据点,但我遇到了一个问题,即数据中有几个空白点。 Of of my columns is calculated, and I have a formula that sets it equal to "" if more than 0 cells that are used in the calculation are blank. 我的of列已计算出来,并且我有一个公式,如果在计算中使用的多个单元格为空,则将其设置为等于“”。 The plots that use the blank cells work fine to show gaps in the data, but Excel doesn't evaluate a cell that has a formula that results in "" as blank. 使用空白单元格的图可以很好地显示数据中的间隙,但是Excel不会评估具有公式的单元格,该公式导致“”为空白。

Therefore, I need to set up some code that can search the entire column of data and clear the formula out of the cells whose value equal "", thereby making them blank and displaying as gaps in the plot. 因此,我需要设置一些代码来搜索整个数据列,并从值等于“”的单元格中清除公式,从而使它们为空白并在图中显示为间隙。

I know I can use the Find and What commands to find the first cell that is evaluated as "", but how can I use it to find all the cells in the column? 我知道我可以使用“ Find和“ What命令来找到第一个被评估为“”的单元格,但是如何使用它来查找列中的所有单元格呢?

The row range for the data is always constant, between 4 and 243 , and the column number I am searching (within a loop) evaluates as 3*(iCounter - 1) + 2 , if that helps anyone. 数据的行范围始终是恒定的,介于4243之间,我正在搜索的列号(在循环内)求值为3*(iCounter - 1) + 2 ,如果有帮助的话。

(The range I am searching is equal to Range(Cells(4, 3*(iCounter - 1) + 2), Cells(243, 3*(iCounter - 1) + 2)) (我正在搜索的范围等于Range(Cells(4, 3*(iCounter - 1) + 2), Cells(243, 3*(iCounter - 1) + 2))

Click on any cell in the column you wish to cleanup and run this: 单击要清除的列中的任何单元,然后运行此命令:

Sub ClearThem()
    Dim BigR As Range, r As Range
    Set BigR = Intersect(ActiveCell.EntireColumn, ActiveSheet.UsedRange)
    For Each r In BigR
        If r.Value = "" Then r.Clear
    Next r
End Sub

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM