Dim chartrange As Range, c As Range
Set chartrange = UsedRange
chartrange.BorderAround
For Each c In chartrange
c.BorderAround XlLineStyle.xlContinuous, XlBorderWeight.xlThin
Next
Dim chartrange As Range, c As Range
Set chartrange = UsedRange
With chartrange.Borders
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 0
End With
ActiveSheet.UsedRange
Set chartrange = UsedRange
Dim laplage_a_traiter As Range
Set laplage_a_traiter = Cells.SpecialCells(xlConstants)
MsgBox laplage_a_traiter.Address
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionDim xlApp As Excel.Application = New Microsoft.Office.Interop.Excel.Application() Dim xlWorkBook As Excel.Workbook Dim xlWorkSheet As Excel.Worksheet Dim chartRange As Excel.Range xlApp.Visible = True xlWorkBook = xlApp.Workbooks.Open(Application.StartupPath & "\exemple.xlsx") xlApp.DisplayAlerts = False xlWorkSheet = xlWorkBook.Worksheets("exemple") chartRange = xlWorkSheet.Range("A1", "V10") 'chartRange = xlWorkSheet.Range("E9") 'chartRange = xlWorkSheet.Range("A1").CurrentRegion.Select() 'chartRange = xlWorkSheet.UsedRange.Select chartRange.Borders.LineStyle = Excel.XlLineStyle.xlContinuous chartRange.Borders.Weight = Excel.XlBorderWeight.xlThin
Je rappelle que je fais mon apprentissage en VB.NET.
Quant qu'au VBA Excel, je ne l'utilise pas ou très peu dans mes scripts.
With fxl
dercol = .cells(1, apxl.Columns.Count).end(-4159).Column ' ==>> -4159 = valeur de xlToLeft
derlig = .range("A" & apxl.rows.Count).end(-4162).row ' ' ==>> -4162 = valeur de xlUp
With .range(.cells(1, 1), .cells(derlig, dercol)).borders
.LineStyle = 1 ' (valeur de xlContinuous)
.Weight = 2 ' (valeur de xlThin)
.ColorIndex = 0 ' (valeur du noir)
End With
End With