Hi Forum,
example:
<tbody>
</tbody>
suppose above is the data on sheet 1
I want to find out sum of last current region of column "E" starting from "5" to "8"
since I am new to VBA I tried below code but no success.
End Sub
"totalval" part is not working and I know the reason because syntax is not right.
please if someone help to resolve it and correct the code.
example:
a | b | c | d | e | |
1 | |||||
2 | |||||
5 | |||||
6 | |||||
7 | |||||
8 | |||||
sum (e5:e8) |
<tbody>
</tbody>
suppose above is the data on sheet 1
I want to find out sum of last current region of column "E" starting from "5" to "8"
since I am new to VBA I tried below code but no success.
Sub findtotal()
firstrow = Sheet1.Cells(Rows.Count, 5).End(xlUp).End(xlUp)
lastrow = Sheet1.Cells(Rows.Count, 5).End(xlUp)
MsgBox firstrow
MsgBox lastrow
MsgBox lastrow
totalval = Application.WorksheetFunction.Sum(Sheet1.Range(firstrow, lastrow))
MsgBox totalval
End Sub
"totalval" part is not working and I know the reason because syntax is not right.
please if someone help to resolve it and correct the code.