vb怎样控制excel每列的对齐方式,不是每个单元的?

解决方案 »

  1.   

    With oSheet.Columns("C:C")
        .HorizontalAlignment = xlCenter
        .VerticalAlignment = xlCenter
        .WrapText = False
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = False
    End With
      

  2.   

    With oSheet.Columns("C:C") '对oSheet这个工作表的"C:C"列进行操作
        .HorizontalAlignment = xlCenter '水平对齐方式:居中
        .VerticalAlignment = xlCenter '垂直对齐方式:居中
    End With水平对齐还可以是xlLeft(靠左)、xlRight(靠右)