Hi there, need some help when using special cells.
In a set of data I'm using special cells type visible to select a filtered row that needs to be modified in an specific cell.
The code I'm using works well for every filter option except if the filter happens to be the first row after the header (heather in row 2:2, filter in row 3:3).
Can you please help.
If ActiveSheet.FilterMode = True Then
'Select cell in 2nd row specific column
ActiveSheet.UsedRange.SpecialCells _
(xlCellTypeVisible).Areas(2).Columns(63).Cells(1, 1).Select
End If
Hi Alberto
Give this a try.
Sub SelectVisibleCells()
Dim LastRow As Long
Dim LastColumn As Long
If ActiveSheet.FilterMode = True Then
LastRow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
LastColumn = ActiveSheet.Cells(1, Columns.Count).End(xlToLeft).Column
ActiveSheet.Cells(1, 1).Offset(1, 0).Resize(LastRow - 1, LastColumn).SpecialCells(xlCellTypeVisible).Select
End If
End Sub
Sunny
Thanks very much for your help Sunny