RGuillermo
asked on
How to put a boder to a set of cells and to color the background??
HI Experts,
Please send me some code that will let me put a border to a group of cells in excell and also to paint with any color the backgroud of this group.
I created a macro but when I copy the code it just does not wrok in another program.
Here is the code, but I will use any other posibility.
Thanks,
Private Sub Macro1()
'
' Macro1 Macro
' Keyboard Shortcut: Ctrl+n
'
ActiveCell.Range("A1:C4"). Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
Selection.Borders(xlDiagon alDown).Li neStyle = xlNone
Selection.Borders(xlDiagon alUp).Line Style = xlNone
With Selection.Borders(xlEdgeLe ft)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTo p)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBo ttom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRi ght)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlInside Vertical). LineStyle = xlNone
Selection.Borders(xlInside Horizontal ).LineStyl e = xlNone
With Selection.Interior
.ColorIndex = 34
.Pattern = xlSolid
End With
End Sub
Please send me some code that will let me put a border to a group of cells in excell and also to paint with any color the backgroud of this group.
I created a macro but when I copy the code it just does not wrok in another program.
Here is the code, but I will use any other posibility.
Thanks,
Private Sub Macro1()
'
' Macro1 Macro
' Keyboard Shortcut: Ctrl+n
'
ActiveCell.Range("A1:C4").
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
Selection.Borders(xlDiagon
Selection.Borders(xlDiagon
With Selection.Borders(xlEdgeLe
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTo
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBo
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRi
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlInside
Selection.Borders(xlInside
With Selection.Interior
.ColorIndex = 34
.Pattern = xlSolid
End With
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER