R
rammieib
Hi. I need help when inserting a line in a database table. Macro below.
However, what I would like is that each line in this database is a
different fill colour, say grey, white, grey, white so I can easily
distinguish between them. How can I write into the macro to do this so
it knows what the colour of the line it is inserting should be?
Cheers
Application.ScreenUpdating = False
Range("A9:FI9").Select
Selection.Insert Shift:=xlDown
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
.Weight = xlThin
End With
Selection.Font.Bold = False
Range("A9").Select
Range("B10:E10").Select
Selection.Copy
Range("B9").Select
Selection.PasteSpecial Paste:=xlPasteValidation, Operation:=xlNone,
_
SkipBlanks:=False, Transpose:=False
Range("A9").Select
Application.CutCopyMode = False
Application.ScreenUpdating = True
However, what I would like is that each line in this database is a
different fill colour, say grey, white, grey, white so I can easily
distinguish between them. How can I write into the macro to do this so
it knows what the colour of the line it is inserting should be?
Cheers
Application.ScreenUpdating = False
Range("A9:FI9").Select
Selection.Insert Shift:=xlDown
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
.Weight = xlThin
End With
Selection.Font.Bold = False
Range("A9").Select
Range("B10:E10").Select
Selection.Copy
Range("B9").Select
Selection.PasteSpecial Paste:=xlPasteValidation, Operation:=xlNone,
_
SkipBlanks:=False, Transpose:=False
Range("A9").Select
Application.CutCopyMode = False
Application.ScreenUpdating = True