Avatar billede familienriis Nybegynder
22. marts 2007 - 08:51 Der er 5 kommentarer og
1 løsning

automatisk sideskift

Jeg har fået hjælp til nedenstående kode på et tidspunkt.
Koden laver et automatisk / tvunget sideskift på de rigtige steder på mit ark......men......
Koden laver fejl hvis der kun er EN side, så der IKKE skal laves sideskift.

Er der nogen der kan hjælpe mig med det problem?







Sub Dan_Sideskift()

Application.ScreenUpdating = True
Cells.PageBreak = xlPageBreakNone

Range(Range("C65536").End(xlUp).Address).Select

Application.ScreenUpdating = False

For Each pb In Worksheets("noter").HPageBreaks

J = pb.Location.Row

    If Rows(J).PageBreak = xlPageBreakAutomatic Then

        If Cells(J, "A") = "" Then

            A = Cells(J, "A").End(xlUp).Row

            Rows(A).PageBreak = xlPageBreakManual

        End If

    End If

Next pb



With Worksheets("noter").HPageBreaks

J = .Item(.Count).Location.Row

    If Rows(J).PageBreak = xlPageBreakAutomatic Then

        If Cells(J, "A") = "" Then

            A = Cells(J, "A").End(xlUp).Row

            Rows(A).PageBreak = xlPageBreakManual

        End If

    End If

End With



'Application.ScreenUpdating = True

Range("A1").Select



End Sub
Avatar billede supertekst Ekspert
22. marts 2007 - 09:29 #1
Lidt inspiration:

    antalSideskift = Worksheets("noter").HPageBreaks.Count
Avatar billede familienriis Nybegynder
22. marts 2007 - 20:01 #2
mange tak for inspirationen, men da jeg ikke selv kan kode forstår jeg ikke præsis hvad jeg skal gøre
Avatar billede kabbak Professor
27. marts 2007 - 00:23 #3
Sub Dan_Sideskift()
    If Worksheets("noter").HPageBreaks.Count > 0 Then    ' NY

        Cells.PageBreak = xlPageBreakNone
        Range(Range("C65536").End(xlUp).Address).Select

        Application.ScreenUpdating = False

        For Each pb In Worksheets("noter").HPageBreaks
            J = pb.Location.Row
            If Rows(J).PageBreak = xlPageBreakAutomatic Then
                If Cells(J, "A") = "" Then
                    A = Cells(J, "A").End(xlUp).Row
                    Rows(A).PageBreak = xlPageBreakManual
                End If
            End If
        Next pb

        With Worksheets("noter").HPageBreaks
            J = .Item(.Count).Location.Row
            If Rows(J).PageBreak = xlPageBreakAutomatic Then
                If Cells(J, "A") = "" Then
                    A = Cells(J, "A").End(xlUp).Row
                    Rows(A).PageBreak = xlPageBreakManual
                End If
            End If
        End With
        'Application.ScreenUpdating = True
        Range("A1").Select

    End If    'NY
End Sub
Avatar billede kabbak Professor
27. marts 2007 - 00:25 #4
Måske skal linien flyttes lidt

Sub Dan_Sideskift()
 
        Cells.PageBreak = xlPageBreakNone
        If Worksheets("noter").HPageBreaks.Count > 0 Then    ' NY
        Range(Range("C65536").End(xlUp).Address).Select

        Application.ScreenUpdating = False

        For Each pb In Worksheets("noter").HPageBreaks
            J = pb.Location.Row
            If Rows(J).PageBreak = xlPageBreakAutomatic Then
                If Cells(J, "A") = "" Then
                    A = Cells(J, "A").End(xlUp).Row
                    Rows(A).PageBreak = xlPageBreakManual
                End If
            End If
        Next pb

        With Worksheets("noter").HPageBreaks
            J = .Item(.Count).Location.Row
            If Rows(J).PageBreak = xlPageBreakAutomatic Then
                If Cells(J, "A") = "" Then
                    A = Cells(J, "A").End(xlUp).Row
                    Rows(A).PageBreak = xlPageBreakManual
                End If
            End If
        End With
        'Application.ScreenUpdating = True
        Range("A1").Select

    End If    'NY
End Sub
Avatar billede familienriis Nybegynder
27. marts 2007 - 09:20 #5
Det var lige det der skulle til, mange tak for hjælpen :-)
Avatar billede familienriis Nybegynder
29. marts 2007 - 09:42 #6
Får jeg ligeet svar :o)
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Excel kurser for alle niveauer og behov – find det kursus, der passer til dig

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester