举个例子我要把Excle中A2、A3、A4三个单元格合并,并要其中写入eeff
xlsheet.Range("A2:A4").MergeCells = True
xlsheet.Range("A2") = "eeff"xlsheet为当前Excle的工作页

解决方案 »

  1.   

    With mysheet
        .Range("A1:F2").MergeCells = True '两个坐标所确定矩形
        .Range("A1") = "你要的内容"
        End With
      

  2.   

    xlSheet.Cells.Range("A1: F2").Merge
    xlSheet.Cells("A1")="anything"
      

  3.   

    Range("A1:B2").Select
        With Selection
            .HorizontalAlignment = xlCenter
            .VerticalAlignment = xlBottom
            .WrapText = False
            .Orientation = 0
            .AddIndent = False
            .ShrinkToFit = False
            .MergeCells = False
        End With
        Selection.Merge