Im trying to autosum the values within a block of cells in Excel using VBA. I kept getting a type mismatch error while debugging the following code. Where did I go wrong?
Sub autosumtest()
Dim total As Integer
Worksheets("Sheet1Test").Select
Range("F16:G20").Select
total = CInt("=SUM(Selection.Values)")
MsgBox (total)
End Sub
EDIT 1: Here is the simple sample of my test data called Autosum Range:

You can use the [] to evaluate any spreadsheet expression.