例文

Rangeプロパティ

  • Range(“B1”)
  • Range(“A1:C5”)
  • Range(“A1″,”C5”)
  • Range(Cells(1, 1), Cells(5, 3))
  • Range(“A:A”)
  • Range(“A:C”)
  • Range(“1:1”)
  • Range(“1:3”)
  • Range(“A1,C5”)

Cellsプロパティ

  • Cells(2, 1)

Rows,Columnsプロパティ

  • Rows(5)
  • Rows(“1:5”)
  • Columns(5)
  • Columns(“A”)
  • Columns(“A:C”)

変数の宣言

  • Dim i as Long
  • Dim i as Long,k as String,j as Double

最終行の取得

  • Cells(Rows.Count, 1).End(xlUp).Row

最終列の取得

  • Cells(1, Columns.Count).End(xlToLeft).Column

For Next

For i = 1 To 3
  Cells(i, k) = 1
Next

Do Loop

Do While i <= 10
  Cells(i, 1) = 5
  i = i + 1
Loop

背景の設定

Range(“B3”).Interior.Color = RGB(0, 0, 255)

Range(“B2”).Interior.Color = vbBlack

Range(“B2”).Interior.Color = xlNone

Range(“B2”).Font.Color = RGB(255, 0, 0)