練習問題10(罫線の練習)メモ
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