Page breaks are on the sheet, i have set them by going to the view menu and
selecting page break preview and then moving them. (e.g. after line 41, 78,
101, 140, 163, 200)
When the marco runs the cursor on the second sheet moves to the cell below
each of these lines but does not add the page break.
"Joel" wrote:
> Sheet number or names in double quotes "Sheet1". what is failing, the code
> is very simple. I found it only failed if there were no page breaks on the
> sheet.
>
> "Stephen C" wrote:
>
> > Thank you for the reply but i am unable to get this code to work.
> >
> > I assume that the 1 and 2 in () represents the sheet names.
> >
> >
> > "Joel" wrote:
> >
> > > Run this macro. It is for horizontal breaks only. I can add vertical breaks
> > > as well
> > >
> > > Sub break()
> > >
> > > For Each pb In Worksheets(1).HPageBreaks
> > > RowNumber = pb.Location.Row
> > > Worksheets(2).Select
> > > Range("A" & RowNumber).Select
> > >
> > > ActiveWindow.SelectedSheets.HPageBreaks.Add before:=ActiveCell
> > > Next pb
> > >
> > > End Sub
> > >
> > > "Stephen C" wrote:
> > >
> > > > I am using office 2000 on an XP computer.
> > > >
> > > > I am trying to copy data from one sheet to another which works fine but i
> > > > also need to copy the page break settings.
> > > >
> > > > I know i can copy the sheet in edit-move or copy, i do not want to do this
> > > > as i already have a sheet set for the information to be pasted onto.
> > > >
> > > > Any help would be grateful.
> > > >
|