VBA checkbox décalés lors de 1ere Impression

Fermé
MICKYSOR - 26 mars 2013 à 13:17
Bonjour,

j'ai une feuille contenant plusieurs checkbox
j'ai un code vba qui me permet de cocher certaines checkbox puis d'imprimer la feuille
j'ai un autre code vba avec le même code,sauf que d'autres checkbox sont cochées

mais je ne comprends pas lors de la première impression sur imprimante toutes les checkbox sont décalés! ensuite ca va mieux.si je change et que je passe à l'autre code avec d'autres checkbox cochées ça me décale tout à nouveau!! Je ne comprends pas

voici un exemple du code vba ci dessous:

With Worksheets("bv recto")

.OLEObjects("checkbox4").Object.Value = True
.OLEObjects("checkbox6").Object.Value = True
End With

Dim strValidationRange As String
Dim rngValidation As Range
Dim rngDepartment As Range

' Turn off screen updating
Application.ScreenUpdating = True

' Identify the source list of the data validation


Range("k:k").Select
Set rngValidation = Range("d71").End(xlDown).Offset(0, 9)
With Range("A350.").Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="=" & rngValidation.Address
' Set the value in the selection cell to each selection in turn
' and print the results.
For Each rngDepartment In rngValidation.Cells
Range("A350.").Value = rngDepartment.Value
ActiveSheet.PrintOut
Next
Range("A12:H15").Select
Application.ScreenUpdating = True
End With

With Worksheets("bv recto")
.OLEObjects("checkbox1").Object.Value = False
.OLEObjects("checkbox2").Object.Value = False
.OLEObjects("checkbox3").Object.Value = False
.OLEObjects("checkbox4").Object.Value = False
.OLEObjects("checkbox5").Object.Value = False
.OLEObjects("checkbox6").Object.Value = False
.OLEObjects("checkbox7").Object.Value = False
.OLEObjects("checkbox8").Object.Value = False
.OLEObjects("checkbox9").Object.Value = False
.OLEObjects("checkbox10").Object.Value = False
.OLEObjects("checkbox11").Object.Value = False
End With

fin:


End Sub