Forum Discussion
sawase
Apr 19, 2021Copper Contributor
Macro/VBA issues, paste and next row
I am a newbie with macros and VBA. I want to set up an excel sheet to import data from a website once a day, calculate the average of once specific row and transfer that value from the sheet to a...
HansVogelaar
Apr 19, 2021MVP
Try this version:
Sub UtrR()
Dim lastrow As Long
Worksheets("Blad1").Range("AA110").FormulaR1C1 = "=AVERAGE(RC[-25]:RC[-2])"
With Worksheets("Sammanställning")
lastrow = .Range("A:B").Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
If lastrow > 1 Then lastrow = lastrow + 1
.Range("A" & lastrow).Value = Date
.Range("B" & lastrow).Value = Worksheets("Blad1").Range("AA110").Value
End With
End Sub