アメリカの大学生活---日記

ミネソタ州立大学ムーアヘッド校 会計学部を5月に卒業して帰国し、税務の仕事してます。

練習問題10(罫線の練習)メモ

 

excel-ubara.com

 

Sub 練習問題10()
  Dim i As Long
  Dim lastRow As Long
  lastRow = Cells(Rows.Count, 1).End(xlUp).Row
  For i = 2 To lastRow
    Cells(i, 4) = Cells(i, 2) / Cells(i, 3)
  Next
  Range(Cells(2, 4), Cells(lastRow, 4)).NumberFormatLocal = "#,##0.00"
  Range(Cells(1, 1), Cells(lastRow, 4)).Borders.LineStyle = xlContinuous
  Range(Cells(1, 1), Cells(lastRow, 4)).Borders.Weight = xlHairline
  Range(Cells(1, 1), Cells(lastRow, 4)).BorderAround   Weight:=xlMedium
  Range(Cells(2, 1), Cells(2, 4)).Borders(xlEdgeTop).Weight = xlThin
  Range(Cells(1, 2), Cells(lastRow, 2)).Borders(xlEdgeLeft).Weight = xlThin
End Sub