I have a Sub that inserts a header from a template and freezes the top row of the active worksheet, which is written as,
Sub HeaderInsert(headerTemplate As Worksheet)
headerTemplate.Rows("1:1").Copy
ActiveSheet.Rows("1:1").Select
ActiveSheet.Paste
With ActiveWindow
.SplitColumn = 0
.SplitRow = 1
.FreezePanes = True
End With
End Sub
I want to turn it into a function which is passed the sheet to insert the header into. So that it would be written,
Function HeaderInsert(headerTemplate As Worksheet, contentSheet as Worksheet)
ActiveSheet
becomes contentSheet
, but how can I get the Window
of contentSheet
?
Also is a better way to do that copy and paste?