rebonsoir Seve
je suis désolé mais je ne vois toujours pas ce que tu veux faire et à quoi peut servir le msgbox ( ou l'inputbox ).... essaies tout de meme cette version de la procedure... avec un peu de chance ......le formatage de la plage fonctionne chez moi...
quand l'input box s'affiche , tu selectionne la zone et ensuite tu cliques sur ok ( nota : les lettres "SG" doivent apparaitre dans une des cellules selectionnées pour que cela fonctionne )
Sub Macro1()
Dim source As Range
Set source = Application.InputBox("Sélectionnez le tableau à formatter", Type:=8)
application.screenupdating=false
With source.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 32
End With
With source.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 32
End With
source.Rows(1).Select
With source.Rows
.RowHeight = 12
End With
With source.Font
.Name = "LucidaSans"
.Size = 7
.Underline = xlUnderlineStyleNone
.ColorIndex = 32
.Bold = True
End With
With source
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.ShrinkToFit = False
.MergeCells = True
End With
source.Rows(2).Select
With source.Rows
.RowHeight = 12
End With
With source.Font
.Name = "LucidaSans"
.Size = 7
.Underline = xlUnderlineStyleNone
.ColorIndex = 32
.Bold = True
End With
With source
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.ShrinkToFit = False
.MergeCells = True
End With
source.Rows(2).Select
With source.Rows
.RowHeight = 12
End With
With source.Font
.Name = "LucidaSans"
.Size = 7
.Underline = xlUnderlineStyleNone
.ColorIndex = 32
End With
With source
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.ShrinkToFit = False
.MergeCells = False
End With
With source.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 32
End With
source.Rows(2).Select
With source.Rows
.RowHeight = 27.75
End With
With source.Font
.Name = "LucidaSans"
.Size = 7
.Underline = xlUnderlineStyleNone
.ColorIndex = 32
.Bold = True
End With
With source
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.ShrinkToFit = False
.MergeCells = False
End With
With source.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 32
End With
source.Rows(2).Select
Range(source, source.End(xlDown)).Select
With source.Rows
.RowHeight = 12
End With
source.Resize(source.Rows.Count - 1).Select
source.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=MOD(ROW(A1);2)=1"
source.FormatConditions(1).Interior.ColorIndex = 53
With source.Font
.Name = "LucidaSans"
.Size = 7
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With source.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 32
End With
source.CurrentRegion.Select
source.Rows(5).Select
Range(source, source.End(xlDown)).Select
With source.Font
.Name = "LucidaSans"
.Size = 7
End With
source.Columns(1).Select
With source
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
With source.Columns
.ColumnWidth = 4
End With
source.Columns(2).Select
With source
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlCenter
.WrapText = False
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
With source.Columns
.ColumnWidth = 20
End With
source.Columns(2).Select
With source
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
With source.Columns
.ColumnWidth = 10
End With
source.Columns(2).Select
With source
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
With source.Columns
.ColumnWidth = 5.38
End With
source.Columns(2).Select
With source
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
With source.Columns
.ColumnWidth = 6
End With
source.CurrentRegion.Select
source.End(xlDown).Select
Range(source, source.End(xlToRight)).Select
With source.Interior
.ColorIndex = 15
End With
With source.Font
.Bold = True
End With
source.CurrentRegion.Select
source.Find(What:="SG", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False).Activate
source.Find("SG").Rows.Select
Range(source, source.End(xlToRight)).Select
With source.Font
.Name = "LucidaSans"
.Size = 7
.Underline = xlUnderlineStyleNone
.ColorIndex = 3
.Bold = False
End With
source.End(xlDown).Select
source.Rows(2).Select
application.screenupdating=true
End Sub
bonne soirée
Michel