Link to home
Start Free TrialLog in
Avatar of Eric Zwiekhorst
Eric ZwiekhorstFlag for Netherlands

asked on

Excel:after search insert pagebreak before active cell in visual basic

I would like to add a page break after I searched a cell with the search function.
I need to select the entire row to insert pagebreak but don't know how to do this when the only reference I have is the activecell.
ASKER CERTIFIED SOLUTION
Avatar of Brian Mulder
Brian Mulder
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Eric Zwiekhorst

ASKER

It does work but adds the pagebreak after the activecell.

I found a answer myself that works

ActiveCell.Rows.Activate
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell
this does the job
ActiveCell.Rows.Activate
    ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell

this does the job, your's did add pagebreak but after the active cell??
sorry thought that was asked for

>>after I searched a cell

but clearly not ..... :)