昨天你帮我解答了关于VB控制录入EXCEL时的文字格式,我想补充一点,如果我还要设置单元格的格式呢?该怎么
1个回答
展开全部
单元格的设置范围太广
With Range("A1:A3") '设置需要设置的单元格或者区域
.NumberFormatLocal = "0.00_ " '设置数字格式
.NumberFormatLocal = "@" '设置为字符格式
.HorizontalAlignment = xlCenter '对齐方式
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
.Borders(xlDiagonalDown).LineStyle = xlNone '下边这些是设置边框线型的,具体值太多了。
.Borders(xlDiagonalUp).LineStyle = xlNone
With .Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End With
With Range("A1:A3") '设置需要设置的单元格或者区域
.NumberFormatLocal = "0.00_ " '设置数字格式
.NumberFormatLocal = "@" '设置为字符格式
.HorizontalAlignment = xlCenter '对齐方式
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
.Borders(xlDiagonalDown).LineStyle = xlNone '下边这些是设置边框线型的,具体值太多了。
.Borders(xlDiagonalUp).LineStyle = xlNone
With .Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End With
来自:求助得到的回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询