Excel Allignment

Break the by cell value

for example if storage location is not same then do break.

'startRow = 9

'FinalRow = nRows '.Range("A65536").End(Excel.XlDirection.xlUp).Row

'LastVal = .Cells(startRow, 8).Value

'For i = startRow To FinalRow

' ThisVal = .Cells(i, 8).Value

' If Not ThisVal = LastVal Then

' .ActiveSheet.HPageBreaks.Add( _

' before:=.Cells(i, 8))

' End If

' LastVal = ThisVal

'Next i

'Break the record in page if more than 39 record in 1 page

If nRows > 39Then

nPagebreaks = Int(nRows / 39)

nPagebreaks = Int((nPagebreaks * 10) + nRows) / 39

For i = 1To nPagebreaks

xlApp.ActiveWindow.SelectedSheets.HPageBreaks.Add(Before:=R.Cells(39 * i, 1))

.Range("A1:K8").Select()

.Selection.Copy()

.Range("A" &CStr(39 * i)).Insert()

.Range("A" &CStr(39 * i)).PasteSpecial()

nPagebreaks = Int(nRows + 12 / 40)

nPagebreaks = Int((nPagebreaks * 10) + nRows) / 39

Next i

EndIf

'After that i detect the break n insert the header right after the break

'Dim BreakRow As Integer

'For i = 0 To .Cells.PageBreak

' BreakRow = ?

' .Range("A1:K8").Select()

' .Selection.Copy()

' '.Range("A" & CStr(39 * i)).Insert()

' '.Range("A" & CStr(39 * i)).PasteSpecial()

' .Range("A" & ).Insert()

' .Range("A" & CStr(39 * i)).PasteSpecial()

'Next

The problem i facing is the login problem

and how do i get the pageBreak Row?

[3678 byte] By [kangkang] at [2007-12-25]