I am looking to insert a new row below a frozen header row at the top of a spreadsheet. The issue I face is the amount of rows in the header is ever changing but I always want the row to be inserted at the first line below the header. Is there a flag in the row that says its frozen? which I could just count the amount of rows with said flag, add 1 and insert row. Any help would be very helpful.
Matt
If you are using FreezePanes
then I think you go this route:
Sub InsertRowBelowHeader()
Rows(ActiveWindow.Panes(1).VisibleRange.Rows.Count + 1).Insert
End Sub
Before, the freeze line is below row 5. Freeze pane was done on cell A6
After, a row is added to split a/b
Here is a relevant discussion which came up on Google for freeze panes and VBA. http://www.mrexcel.com/forum/excel-questions/275645-identifying-freeze-panes-position-sheet-using-visual-basic-applications.html
Here you are!
Sub InsertRowBelowHeader()
Rows(ActiveWindow.SplitRow + 1).Insert
End Sub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With