Hi
try the code
Code:
--------------------
Sub test()
Dim myR As Range, myRange As Range, myCol As Integer, x
On Error GoTo Last
Set myR = Application.InputBox("select column haeding that you want to test", Type:=8)
Application.ScreenUpdating = False
With myR
myCol = .Column
Set myRange = Range(myR, Cells(65536, myCol).End(xlUp))
End With
On Error Resume Next
myRange.AdvancedFilter xlFilterInPlace, unique:=True
x = myRange.SpecialCells(xlCellTypeVisible).Count
If x <= 2 Then
ActiveSheet.ShowAllData
myRange.EntireColumn.Hidden = True
Else
ActiveSheet.ShowAllData
myRange.EntireColumn.Hidden = False
End If
Last:
Application.ScreenUpdating = True
End Sub
--------------------
--
jindon
------------------------------------------------------------------------
jindon's Profile:
http://www.excelforum.com/member.php...o&userid=13135
View this thread:
http://www.excelforum.com/showthread...hreadid=378003