Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2003-02-21
4
Medium Priority
?
435 Views
Last Modified: 2008-01-09
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.
0
Comment
Question by:Eric Zwiekhorst
  • 2
  • 2
4 Comments
 
LVL 44

Accepted Solution

by:
bruintje earned 600 total points
ID: 7992778
Hello Zwiekhorst,

you could try something like

Sub InsertBreak()
  'Will insert a page break after the activecell
  ActiveSheet.HPageBreaks.Add Before:=ActiveCell.Offset(1, 0)
End Sub

HAGD:O)Bruintje
0
 
LVL 6

Author Comment

by:Eric Zwiekhorst
ID: 7992847
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
0
 
LVL 6

Author Comment

by:Eric Zwiekhorst
ID: 7992860
ActiveCell.Rows.Activate
    ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell

this does the job, your's did add pagebreak but after the active cell??
0
 
LVL 44

Expert Comment

by:bruintje
ID: 7993786
sorry thought that was asked for

>>after I searched a cell

but clearly not ..... :)
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Rules and regulations were devised in order to maintain the integrity of a system. However, interpretation of rules can be quite tricky.
There are literally thousands of Exchange recovery applications out there. So how do you end up picking one that’s ideal for your business & purpose? By carefully scouting the product’s features, the benefits it offers you, & reading ample reviews f…
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question