ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel97 - Syntax for Find, Offset, Insert Page (https://www.excelbanter.com/excel-programming/341844-excel97-syntax-find-offset-insert-page.html)

DJH

Excel97 - Syntax for Find, Offset, Insert Page
 
Within an Excel 97 sheet, I want to find all occurrences of a certain string
text. From each of these cells, I need to go down one row and left one cell,
and insert a page break. I am having trouble with the syntax to accomplish
this, particularly with what is needed to position me at the desired point
for the page insert.


Tom Ogilvy

Excel97 - Syntax for Find, Offset, Insert Page
 
Dim rng as Range
set rng = cells.Find("StringTarget")
if not rng is nothing then
sAddr = rng.Address
do
Activesheet.HPageBreaks.Add rng.offset(1,-1)
set rng = cells.findnext(rng)
loop while rng.Address < sAddr

Adjust to suit

--
Regards,
Tom Ogilvy


"djh" wrote in message
...
Within an Excel 97 sheet, I want to find all occurrences of a certain

string
text. From each of these cells, I need to go down one row and left one

cell,
and insert a page break. I am having trouble with the syntax to

accomplish
this, particularly with what is needed to position me at the desired point
for the page insert.




DJH

Excel97 - Syntax for Find, Offset, Insert Page
 
Tom,
Thank you very much. That was just what I needed to get me started on my
macros.
Debbie

"Tom Ogilvy" wrote:

Dim rng as Range
set rng = cells.Find("StringTarget")
if not rng is nothing then
sAddr = rng.Address
do
Activesheet.HPageBreaks.Add rng.offset(1,-1)
set rng = cells.findnext(rng)
loop while rng.Address < sAddr

Adjust to suit

--
Regards,
Tom Ogilvy


"djh" wrote in message
...
Within an Excel 97 sheet, I want to find all occurrences of a certain

string
text. From each of these cells, I need to go down one row and left one

cell,
and insert a page break. I am having trouble with the syntax to

accomplish
this, particularly with what is needed to position me at the desired point
for the page insert.






All times are GMT +1. The time now is 12:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com