ActiveCell.Range("A1:A2").Select With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlTop .WrapText = True .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = True .ReadingOrder = xlContext .MergeCells = False End With Selection.Merge ActiveCell.Offset(0, 1).Range("A1:A2").Select With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlTop .WrapText = False .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = True .ReadingOrder = xlContext .MergeCells = False End With Selection.Merge ActiveCell.Offset(0, 2).Range("A1:A2").Select With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlTop .WrapText = True .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = True .ReadingOrder = xlContext .MergeCells = False End With Selection.Merge ActiveCell.Offset(0, -1).Range("A1:A2").Select With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlTop .WrapText = True .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = True .ReadingOrder = xlContext .MergeCells = False End With Selection.Merge ActiveCell.Offset(0, -3).Range("A1:AK2").Select Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlMedium End With With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlMedium End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlMedium End With With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlMedium End With With Selection.Borders(xlInsideVertical) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With ActiveCell.Offset(2, 1).Range("A1").Select End Sub
[/vba]
Работает если начать с ячейки B9 Этот макрос объединяет ячейки и потом обводит 2 строки жирным по границе
Как сделать чтобы это все происходило для всех строк? около (300) И как сделать чтобы он не был привязан к определенной ячейке, чтобы просто с любой работал, но начинал свою работу именно с 9 строки? [moder]Оформите коды тегами (кнопка #)[/moder] [moder]Чтобы применить теги, надо выделить код и нажать кнопку # на панели инструментов формы сообщения[/moder]
[vba]
Код
Sub Макрос1()
ActiveCell.Range("A1:A2").Select With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlTop .WrapText = True .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = True .ReadingOrder = xlContext .MergeCells = False End With Selection.Merge ActiveCell.Offset(0, 1).Range("A1:A2").Select With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlTop .WrapText = False .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = True .ReadingOrder = xlContext .MergeCells = False End With Selection.Merge ActiveCell.Offset(0, 2).Range("A1:A2").Select With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlTop .WrapText = True .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = True .ReadingOrder = xlContext .MergeCells = False End With Selection.Merge ActiveCell.Offset(0, -1).Range("A1:A2").Select With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlTop .WrapText = True .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = True .ReadingOrder = xlContext .MergeCells = False End With Selection.Merge ActiveCell.Offset(0, -3).Range("A1:AK2").Select Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlMedium End With With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlMedium End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlMedium End With With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlMedium End With With Selection.Borders(xlInsideVertical) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With ActiveCell.Offset(2, 1).Range("A1").Select End Sub
[/vba]
Работает если начать с ячейки B9 Этот макрос объединяет ячейки и потом обводит 2 строки жирным по границе
Как сделать чтобы это все происходило для всех строк? около (300) И как сделать чтобы он не был привязан к определенной ячейке, чтобы просто с любой работал, но начинал свою работу именно с 9 строки? [moder]Оформите коды тегами (кнопка #)[/moder] [moder]Чтобы применить теги, надо выделить код и нажать кнопку # на панели инструментов формы сообщения[/moder]letasm
Сообщение отредактировал letasm - Суббота, 23.04.2016, 15:08