View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Hide rows without data in a column based on active cell

Hi Johan,

Am Wed, 9 Mar 2016 23:04:00 +0100 schrieb Claus Busch:

try dollowing code in the module of the expected worksheet:


sorry, I didn't read carefully. Try instead:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim LCol As Long

LCol = Cells(2, Columns.Count).End(xlToLeft).Column
If Intersect(Target, Range(Cells(1, 1), Cells(2, LCol))) Is _
Nothing Or Target.Count 1 Then Exit Sub

If Target.Row = 1 Then
ActiveSheet.AutoFilterMode = False
Else
ActiveSheet.UsedRange.AutoFilter field:=Target.Column, _
Criteria1:="<" & ""
End If
End Sub


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional