![](/img/trans.png)
[英]VBA Macro to Sort a Column but add a value to the original value if there are duplicates
[英]How to add a VBA macro which remove ALL the duplicates including the original based on a specific condition
我迫切需要一些幫助
我是宏的新手,並且一直停留在此宏上:(它正在使我的頭腦...
我有一個大約20,000行30列的Excel工作表
以下是摘要,我要刪除所有具有法拉利車隊的會員,我需要宏刪除所有具有法拉利車隊的客戶(行).....但是,我也需要刪除宏,因為該同一個顧客具有法拉利,他還擁有寶馬,也許還有其他汽車
因此,宏將刪除第1,2行,然后刪除第4行(技巧是使宏刪除第#1行的第2行,因為它是同一位擁有法拉利和另一輛車的客戶,因此我不需要向客戶推銷任何東西一種
Customer Car
1-法拉利
2-寶馬
3- B奔馳
4-D法拉利
5-日產
sub remover()
for each veh in sheets("sheet1").range("B2:B999").cells
if veh.value = "ferrari" or veh.value = "Ferrari" then
customer = veh.offset(0, -1).value
veh.entirerow.delete
for each cust in sheets("sheet1").range("A2:A999").cells
if cust.value = customer then
cust.entirerow.delete
endif
next
end if
next
End Sub
未測試-請原諒,任何錯誤,請盡早解決,絕對可以為您解決問題的一種方法。 如果不起作用。 讓我知道。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.