How to create a header row???

mmartin

New Member
Joined
Apr 10, 2002
Messages
10
I'm trying to split up a sheet using page breaks:

Sub PageBreaker()

Dim rFound As Range

Set rFound = Cells.Find("Marker", LookIn:=xlValues)
If Not rFound Is Nothing Then
firstAddress = rFound.Address
Do
With rFound.EntireRow
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=rFound.Offset(3, 0)
End With
Set rFound = Cells.FindNext(rFound)
Loop While Not rFound Is Nothing And rFound.Address <> firstAddress
End If


End Sub

and that's working fine !

But when I add the following code in the innermost with statement to create a row where I can add column headers the whole thing goes into a continuous loop :

rFound.EntireRow.Insert

If I get this working how do I add the same text in the header rows. Something like this?? But how do I work it for each newly inserted row??

Range("B*").Select
ActiveCell.FormulaR1C1 = "Column B"

I don't know how to get the cell references right.

Please Help !!!!!!!!
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Hi
Post is trash...
My post was
Tom
This message was edited by TsTom on 2002-04-23 02:10
 
Upvote 0

Forum statistics

Threads
1,214,430
Messages
6,119,454
Members
448,898
Latest member
drewmorgan128

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top