删除特定行 [英] Deleting specific rows
问题描述
我必须为里程计算器生成Excel VBA宏,因此我必须保留特定名称的第一项和最后一项,并删除其间的所有值。例如:
所以我想离开前一个 Rivor Minor253
和最后一个
有人可以为我提供适合我的描述的宏吗?
如果有可能,请先打开录制宏。假设 CHAINAGE
在ColumnA中的第39行中,并向下复制以适合您,请尝试:
= OR(COUNTIF(B $ 1:B39,B39)= 1,COUNTIF(B $ 1:B39,B39)= COUNTIF(B:B,B39))
然后过滤该列以选择并删除FALSE行。
I have to generate a Excel VBA macro for a chainage calculator, so I have to leave the first entry and last entry of a specific name and delete all the values in between. For example:
So I want to leave the first Rivor Minor253
and the last Rivor Minor253
, but all the middle ones must be deleted. Now, I could do this manually but I have over 3,000 rows which will take me days to complete, and I could generate a macro which deletes duplicates but I don't know how to generate one which will only delete the middle ones.
Could anyone provide me with a macro that fits my description?
Turn on Record Macro first, if inclined to do so. Assuming CHAINAGE
is in ColumnA, in Row39 and copied down to suit please try:
=OR(COUNTIF(B$1:B39,B39)=1,COUNTIF(B$1:B39,B39)=COUNTIF(B:B,B39))
Then filter that column to select and delete rows FALSE.
这篇关于删除特定行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!