[英]How do I clear content in rows based on cell value?
I copy a lot of information (1000 rows and at least 24 columns) from one sheet to another. 我将很多信息(1000行和至少24列)从一张纸复制到另一张纸。 A lot of the cells contains "".
许多单元格包含“”。 This makes my other formulas(for example: A1-B1) to show an value error if either of these cells contains "".
如果这些单元格中的任何一个包含“”,这会使我的其他公式(例如:A1-B1)显示值错误。 I believe I can solve the problem by never pasting "" but a "0" instead.
我相信我可以通过不粘贴“”而是粘贴“ 0”来解决问题。 But I would like to delete these "0" afterwards.
但是,我想随后删除这些“ 0”。
There could be values in the first 3 rows but the other 997 rows have "". 前3行中可能有值,但其他997行中有“”。
I would think I need to tell my macro to (Cell A1 in the "sheet1" sheet displays "G5:H12". the cells I need to delete): 我想我需要告诉宏(“ sheet1”工作表中的单元格A1显示“ G5:H12”。我需要删除的单元格):
Rowstodelete = Sheets("sheet1").Range("A1").Value
Sheets("sheet1").Range("rowstodelete").clearcontent
This does not work. 这是行不通的。 anyone know how to do this?
有人知道怎么做吗?
Summary(new example) 摘要(新示例)
If cell A1 = "B1:B2" I want to clear the content of B1 and B2, but if A1 now = B4:B6, that is the cells that should be cleared. 如果单元格A1 =“ B1:B2”,我想清除B1和B2的内容,但是如果现在A1 = B4:B6,则应清除这些单元格。
Try this one: 试试这个:
With Worksheets(1).Range( _'PLACE YOUR RANGE
)
Set c = .Find(0, lookin:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Value = ""
Set c = .FindNext(c)
Loop While Not c Is Nothing
End If
End With
Hope it helps 希望能帮助到你
Anyhow, I think that will be simpler to place a condition in your operation formula: =IF(OR(A1="",B1=""),Make when there is an unexpected value,A1-B1)
无论如何,我认为在您的运算公式中放置条件会更简单:
=IF(OR(A1="",B1=""),Make when there is an unexpected value,A1-B1)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.