VBA入門① No.4 Withステートメントの使い方
- VBAでもwithが使えるよー!
文法
With 使いまわすコード 処理1 処理2 処理3 End With
サンプルコード
Sub myWith() With Worksheets("Sheet1") .Cells(1, 1).Value = "hello" .Cells(1, 2).Value = "vba" .Cells(1, 3).Value = "world" End With End Sub
文法
With 使いまわすコード 処理1 処理2 処理3 End With
Sub myWith() With Worksheets("Sheet1") .Cells(1, 1).Value = "hello" .Cells(1, 2).Value = "vba" .Cells(1, 3).Value = "world" End With End Sub