看板 Office 關於我們 聯絡資訊
軟體:excel 版本:2007以上 我用google表單有一堆報名資料 但是有人重新報名就是會有最新資料 我要只保留最新資料 找到下面的函數 http://isvincent.pixnet.net/blog/post/45005972 =IF(COUNTIF(A$2:A2,A2)<COUNTIF(A$2:A$26,A2),"",A2) 嘗試用到vba內 Sub Macro1() Dim x, y As Long Dim i As Integer Sheets("資料").Select For i = 1 To Range("A1").End(xlDown).Row x = Application.CountIf(Range("A1:A" & i), Range("A" & i)) y = Application.CountIf(Range("A1", Range("A1").End(xlDown)), Range("A" & i)) If x > y Then Rows(i).Select Selection.Delete Shift:=xlUp End If Next i End Sub 不過發現似乎我的邏輯還是有問題 不知道那邊要修改 XD 感謝各位大大... -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.136.224.235 ※ 文章網址: https://www.ptt.cc/bbs/Office/M.1491191027.A.6BD.html
soyoso: 將迴圈以遞減step -1方式,判斷上改為y>x 04/03 12:32
soyoso: 其他無變更,以原文網頁內資料執行後 04/03 12:35
soyoso: https://i.imgur.com/GxeeSo2 04/03 12:35
感謝S大指點 http://i.imgur.com/MtzF7dO.jpg 會成功 不過最後出現那一行是錯誤.... ※ 編輯: ptguitar (114.136.224.235), 04/03/2017 12:44:23
ptguitar: 我知道了 最後迴圈不能到0 04/03 12:45