Re : Copier une image et coller dans tous les onglets
Re,
j'ai parlé trop vite, quand je colle le code dans mon fichier original cela bloc. et j'ai oublier de dire qu'il y a des onglets ou l'image ne doit pas aller.pouvez-vous m'aider?
Ci-joint les deux codes dans le ThisWorkbook
Merci
Picronte
Option Explicit
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim s As Shape, T As Object, F As Object, CF, CL
For Each s In Feuil30.Shapes
If s.Name Like "*Rectang*" Then
Set T = s.TextFrame
Set F = T.Characters.Font
CF = s.Fill.ForeColor.RGB 'remplissage
CL = s.Line.ForeColor.RGB 'bordure
Exit For
End If
Next
For Each s In Sh.Shapes
If s.Name Like "*Rectang*" Then
With s.TextFrame
If Left(.Characters.Text, 1) = " " Then Exit For 'évite toute modification
.Characters.Text = T.Characters.Text
.HorizontalAlignment = T.HorizontalAlignment
.VerticalAlignment = T.VerticalAlignment
'.ReadingOrder = T.ReadingOrder
.Orientation = T.Orientation
'.AutoSize = T.AutoSize
With .Characters.Font
.Name = F.Name
.FontStyle = F.FontStyle
.Size = F.Size
.Strikethrough = F.Strikethrough
.Superscript = F.Superscript
.Subscript = F.Subscript
.OutlineFont = F.OutlineFont
.Shadow = F.Shadow
.Underline = F.Underline
.Color = F.Color
End With
End With
s.Fill.ForeColor.RGB = CF
s.Line.ForeColor.RGB = CL
Exit For
End If
Next
End Sub
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim s As Shape
With Sheets("BERANGER") 'à adapter
If Sh.Name <> .Name Then
For Each s In Sh.Shapes
If s.TopLeftCell.Address = "$B$1" _
Or s.TopLeftCell.Address = "$B$44" Then s.Delete
Next
For Each s In .Shapes
If s.TopLeftCell.Address = "$B$1" Then s.Copy: Sh.Paste Sh.[B1]
If s.TopLeftCell.Address = "$B$44" Then s.Copy: Sh.Paste Sh.[B44]
Next
End If
End With
End Sub