Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Experts
I have have data as below CD01A01 CD22B10 CE10E01 CE15X02 CF16S01 I need a macro that will insert a page break when the second letter changes i. e. CD items will be on one sheet, CE's will be on another etc Regards Gaz -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200511/1 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Something like this?
Option Explicit Sub testme01() Dim iRow As Long Dim FirstRow As Long Dim LastRow As Long With ActiveSheet FirstRow = 2 LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For iRow = FirstRow To LastRow If LCase(Left(.Cells(iRow, "A").Value, 2)) _ = LCase(Left(.Cells(iRow + 1, "A").Value, 2)) Then 'do nothing Else .HPageBreaks.Add Befo=.Cells(iRow + 1, "A") End If Next iRow End With End Sub I checked the first 2 characters of the cell. Gaz wrote: Hi Experts I have have data as below CD01A01 CD22B10 CE10E01 CE15X02 CF16S01 I need a macro that will insert a page break when the second letter changes i. e. CD items will be on one sheet, CE's will be on another etc Regards Gaz -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200511/1 -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2007 Page Break Adjustments causes a page break each cell | Excel Worksheet Functions | |||
Page Break Macro | Excel Programming | |||
Page Break Macro | Excel Programming | |||
Using macro for page break | Excel Discussion (Misc queries) | |||
Page break macro | Excel Worksheet Functions |