你想隱藏單元格或行,如果你的選擇是您可以使用此子讀取所有的行到表中,如果二路映像名稱和圖像當前行的版本是以前的一些行成爲當前行會被隱藏的
Sub HideDoubleRst()
Application.ScreenUpdating = False
Dim UR As Long, X As Long
Dim MyCol As Integer
MyCol = Range("A:A").Column
UR = Cells(Rows.Count, MyCol).End(xlUp).Row
For X = 2 To UR
If Cells(X, MyCol) = Cells(X - 1, MyCol) And Cells(X, MyCol + 1) = Cells(X - 1, MyCol + 1) Then
Rows(X).Select
Selection.EntireRow.Hidden = True
End If
Next X
Application.ScreenUpdating =真 結束小組 或者,如果你只想隱藏2個細胞您CA n改變背景顏色和你fontcolor到白色
Sub ColorDoubleRst()
Application.ScreenUpdating = False
Dim UR As Long, X As Long
Dim MyCol As Integer
MyCol = Range("A:A").Column
UR = Cells(Rows.Count, MyCol).End(xlUp).Row
For X = 2 To UR
If Cells(X, "A") = Cells(X - 1, "A") Then
Cells(X, "A").Select
With Selection.Font
.ThemeColor = xlThemeColorDark1
End With
With Selection.Interior
.ThemeColor = xlThemeColorDark1
End With
If Cells(X, "B") = Cells(X - 1, "B") Then
Cells(X, "B").Select
With Selection.Font
.ThemeColor = xlThemeColorDark1
End With
With Selection.Interior
.ThemeColor = xlThemeColorDark1
End With
If Cells(X, "F") = Cells(X - 1, "F") Then
Cells(X, "F").Select
With Selection.Font
.ThemeColor = xlThemeColorDark1
End With
With Selection.Interior
.ThemeColor = xlThemeColorDark1
End With
End If
End If
End If
Next X
Application.ScreenUpdating = True
End Sub
我想隱藏只是2個單元格。在A2中,我們有Image S400和B2 1.3。現在我只想在這種情況下隱藏單元格A3和B3,因爲它們與上面相同。例如「圖像名稱」是圖像S400,但「圖像版本」是1.4例如,然後只隱藏單元格「圖像名稱」 – Declade
@Declare,我添加子ColorDoubleRst,我認爲你想 – Fabrizio
這個作品真棒,謝謝您。但是我得到了最後一個問題,如果我想添加另一列來檢查那裏,我會在那裏做什麼?例如NotebookName列F? – Declade