lezawang
Well-known Member
- Joined
- Mar 27, 2016
- Messages
- 1,805
- Office Version
- 2016
- Platform
- Windows
Hi
The code below for some reason does not work. I tried to pass the range between " " but did not work. Any help would be appreciated
The code below for some reason does not work. I tried to pass the range between " " but did not work. Any help would be appreciated
Code:
' did not work either
Cells(1, 3).Value = WorksheetFunction.Sum("myrange")
Code:
Sub worksheetfunctions()
Range("a1:a20").Name = "myrange"
Range("myrange").Value = WorksheetFunction.RandBetween(1, 100)
''''''' all functions below did not work '''''''''''''''''''''''''
Cells(1, 3).Value = WorksheetFunction.Sum(myrange)
Cells(2, 3).Value = WorksheetFunction.Average(myrange)
Cells(3, 3).Value = WorksheetFunction.CountA(myrange)
Cells(4, 3).Value = WorksheetFunction.Max(myrange)
Cells(5, 3).Value = WorksheetFunction.Min(myrange)
End Sub
Last edited: