如何设置单元格里的内容不可编辑,以及设置单元格有表格线?

解决方案 »

  1.   

    设置表格线: 
       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)
            .LineStyle = xlContinuous
            .Weight = xlThin
            .ColorIndex = xlAutomatic
        End With
    设置单元格不可编辑:
        ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
      

  2.   

    这种关于Excel问题我建议先录制一段宏
      

  3.   

    设置文本
    ActiveSheet.Selection.NumberFormatLocal = "@"
    输出时带0开头的文本能正确显示
    设置数字ActiveSheet.Selection.NumberFormatLocal = "#,##0.00"其他你慢慢找吧