Add new row when filter is applied
I have already created a file and filter some of the columns of it.Over here i want that i can copy some of the cell in the filter column and paste it at the end where there is a blank space.If i try to do so i am getting a message as ArrayIndexOutOfBoundsException : 182. Can anyone tell me what steps i need to follow for the same.
Re: Add new row when filter is applied
Try to run the following macro and you would be able to add new row.
Code:
Sub Macro1()
With ThisWorkbook.Sheets("sheet1")
firstFreeRow = .Range("b1").CurrentRegion.Rows.Count + 1
areasCount = .Range("c2:c" & firstFreeRow - 1).SpecialCells(xlCellTypeVisible). _
Areas.Count
bAddress = Split(.Range("c2:c" & firstFreeRow - 1).SpecialCells(xlCellTypeVisible) _
.Areas(areasCount).Address(False, False), ":")
End With
End Sub