可否用with结构优化一下?

下面的代码(一大段代码的部分行)成功运行,测试通过了

    With ws.Range(record_line & ":" & record_line).Font
        .Name = "Arial Unicode MS"
        .Size = 12
    End With
    ws.Cells.EntireColumn.AutoFit
    With ws.PageSetup
        .PrintArea = ""
        .FitToPagesWide = 1
        .Orientation = xlLandscape
    End With

我想优化一下,可否用一个with结构来解决?

阅读 221
1 个回答
With ws
    .Range(record_line & ":" & record_line).Font.Name = "Arial Unicode MS"
    .Range(record_line & ":" & record_line).Font.Size = 12
    .Cells.EntireColumn.AutoFit
    With .PageSetup
        .PrintArea = ""
        .FitToPagesWide = 1
        .Orientation = xlLandscape
    End With
End With
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏