VBA - insert rows under dynamic header

I want to insert a new row below the frozen header row at the top of the table. The problem I am facing is that the number of rows in the header is constantly changing, but I always want the row to be inserted in the first row under the header. Is there a flag in the line that says it's frozen? which I could just count the number of rows with the specified flag, add 1 and insert a row. Any help would be very helpful.

Matt

+5
source share
2 answers

There you are!

Sub InsertRowBelowHeader() Rows(ActiveWindow.SplitRow + 1).Insert End Sub 
+3
source

If you are using FreezePanes , then I think you are following this route:

 Sub InsertRowBelowHeader() Rows(ActiveWindow.Panes(1).VisibleRange.Rows.Count + 1).Insert End Sub 

Until the freezing line is below line 5. A closed panel was made on cell A6

before

After , a line is added to separate a / b

after

Here is a suitable discussion that came up on Google for freezing windows and VBA. http://www.mrexcel.com/forum/excel-questions/275645-identifying-freeze-panes-position-sheet-using-visual-basic-applications.html

+6
source

All Articles