vzachin
05-21-2008, 06:29 AM
hi,
this is not a vba question.
i need to apply an autofilter in D4 and following columns if there is data in D5. in each subsequent column, if there is data, then there will be a header in the corresponding row. this works fine but if there is only one column D4 of data, when i apply the autofilter in D4, the autofilter is in D1. If i remove the entries in D13, then the autofilter will be applied in D4.
why is that? what am i doing wrong?
Sub AutoFiltOn2()
With ActiveSheet
.AutoFilterMode = False
If .Range("D5") <> "" Then
iCols = .Cells(4, .Columns.Count).End(xlToLeft).Column
.Range("D4", .Cells(4, iCols)).AutoFilter
End If
End With
End Sub
End Sub
thanks
zach
this is not a vba question.
i need to apply an autofilter in D4 and following columns if there is data in D5. in each subsequent column, if there is data, then there will be a header in the corresponding row. this works fine but if there is only one column D4 of data, when i apply the autofilter in D4, the autofilter is in D1. If i remove the entries in D13, then the autofilter will be applied in D4.
why is that? what am i doing wrong?
Sub AutoFiltOn2()
With ActiveSheet
.AutoFilterMode = False
If .Range("D5") <> "" Then
iCols = .Cells(4, .Columns.Count).End(xlToLeft).Column
.Range("D4", .Cells(4, iCols)).AutoFilter
End If
End With
End Sub
End Sub
thanks
zach