Sub direct_Price() ''定义变量 Dim cRows As Integer '总行数 Dim cColumns As Integer '总列数 Dim HEADERCOLORINDEX As Integer '表头的背景色 Dim cTemp As Integer '临时计数 Dim sTempString As String '临时字符串变量 Dim i As Integer '临时计数 Dim j As Integer '临时计数 Dim rowIndex As Integer '临时指示处理到哪里 Dim colIndex As Integer '临时指示处理到哪里 Dim tempRndColor As Integer '临时生成的颜色 Dim TABLENAME As String '待处理的表名 Dim colorIndex As String '颜色索引名字 '''''''''''''''''''''''''''''''''''''''''''''' '表头的背景色 HEADERCOLORINDEX = 15 colorIndex = 36 '颜色从33 开始是比较浅的颜色 TABLENAME = "direct_Price" '关闭所有弹出的警告消息 Application.DisplayAlerts = False '设置需要处理的单元表 Sheets(TABLENAME).Select '取单元表的总列数与总行数 cRows = Sheets(TABLENAME).UsedRange.Rows.Count cColumns = Sheets(TABLENAME).UsedRange.Columns.Count '''''''''''''''''''''''''''''''''''''''''''''' '选择所有的单元格 Range(Cells(1, 1), Cells(cRows, cColumns)).Select '设置该表中所有单元行高为 11.25 Selection.RowHeight = 11.25 '设置该表中所有单元行高为 11.25 Selection.RowHeight = 11.25 '设置所有的边框 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 Sele...