|
他にもやり方はあります。たとえばこんな感じで。
Sub MyRow_SUM()
Dim Sh As Worksheet
Dim WB As Workbook
Dim LsR As Long
Set Sh = ActiveSheet
Application.ScreenUpdating = False
Sh.Cells.ClearContents
Sh.Cells(1).Value = "Loto6.csv"
Set WB = Workbooks.Open(ThisWorkbook.Path & "\Loto6.csv")
LsR = WB.Worksheets(1).Range("A65536").End(xlUp).Row
With Sh.Cells(257)
.Value = "1行目計"
.AutoFill .Resize(LsR - 2), xlFillSeries
End With
With WB.Worksheets(1).Range("M3:M" & LsR)
.Formula = "=SUM($C3:$L3)"
.Copy
.ClearContents
End With
Sh.Cells(258).PasteSpecial xlPasteValues
WB.Close False: Set Sh = Nothing: Set WB = Nothing
With Application
.CutCoyMode = False
.ScreenUpdating = True
End With
End Sub
|
|