2015-07-06 41 views
0

我想隐藏表格中的重复单元格。见图。隐藏表格中的重复单元格

http://imgur.com/UoNKcBI

结果(我manualy隐藏NotebookNames,那是什么我的意见是关于)

http://imgur.com/jVnhJAa

在第一列中,我们得到了 “映像文件名”,我想隐藏(油漆细胞白色)的重复,只留下第一个“重复”了。 在第二列中有“图像版本”,我也想在这里隐藏重复项,但依赖于“图像名称”列。因此,如果有2次“Image S400”+ 1.3版,请隐藏第2张“图像名称”+“图像版本”。

我正在尝试这个,现在有条件格式,但我确定这不是方法。

这是可能与条件格式?还是我必须用VBA解决这个问题?

的问候和美好的一周

Declade

回答

0

你想隐藏单元格或行,如果你的选择是您可以使用此子读取所有的行到表中,如果二路映像名称和图像当前行的版本是以前的一些行成为当前行会被隐藏的

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 
+0

我想隐藏只是2个单元格。在A2中,我们有Image S400和B2 1.3。现在我只想在这种情况下隐藏单元格A3和B3,因为它们与上面相同。例如“图像名称”是图像S400,但“图像版本”是1.4例如,然后只隐藏单元格“图像名称” – Declade

+0

@Declare,我添加子ColorDoubleRst,我认为你想 – Fabrizio

+0

这个作品真棒,谢谢您。但是我得到了最后一个问题,如果我想添加另一列来检查那里,我会在那里做什么?例如NotebookName列F? – Declade

相关问题