fork download
  1. Option Explicit
  2.  
  3. Public Sub 非表示()
  4. Dim wrow As Long
  5. Dim ws As Worksheet
  6. Dim dicROW As Object
  7. Dim dicPC As Object
  8. Dim maxrow As Long
  9. Dim key As Variant
  10. Dim cellE As String
  11. Dim elms As Variant
  12. Dim i As Long
  13. Set ws = ActiveSheet
  14. ws.Cells.EntireRow.Hidden = False
  15. maxrow = ws.Cells(rows.Count, "D").End(xlUp).Row
  16. Set dicROW = CreateObject("Scripting.Dictionary")
  17. Set dicPC = CreateObject("Scripting.Dictionary")
  18.  
  19. For wrow = 10 To maxrow
  20. key = ws.Cells(wrow, "D").Value
  21. If key <> "" Then
  22. cellE = ws.Cells(wrow, "E").Value
  23. If dicROW.exists(key) = False Then
  24. dicROW(key) = wrow
  25. dicPC(key) = False
  26. Else
  27. dicROW(key) = dicROW(key) & "," & wrow
  28. End If
  29. If InStr(1, cellE, "PC", vbTextCompare) = 0 Then
  30. dicPC(key) = True
  31. End If
  32. End If
  33. Next
  34. For Each key In dicROW.keys
  35. If dicPC(key) = True Then
  36. elms = Split(dicROW(key), ",")
  37. If UBound(elms) >= 1 Then
  38. For i = 0 To UBound(elms)
  39. ws.rows(elms(i)).Hidden = True
  40. Next
  41. End If
  42. End If
  43. Next
  44. End Sub
  45.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty