|
-
Aug 1st, 2012, 06:47 AM
#41
Re: SUM of selected cell range
by correctly, i meant the sum showed in the cell, not the formula
i just pasted your code into my ide and set a range to suit
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Aug 5th, 2012, 12:09 PM
#42
Thread Starter
Lively Member
Re: SUM of selected cell range
Hi Seenu,
I got below error:
Run-time error '1004':
Method 'Rows' of object '_Global' failed
Code:
Sub calculateSubtotalOfRows(sRange As String, sumRowEnd As Integer)
Dim i As Integer
For i = 1 To sumRowEnd
sumRowEnd = Cells(Rows.count, i).End(xlUp).Row
Cells(sumRowEnd + 1, i) = WorksheetFunction.SUM(range(Cells(1, i), Cells(sumRowEnd, i)))
Next
End Sub
-
Aug 5th, 2012, 12:10 PM
#43
Thread Starter
Lively Member
Re: SUM of selected cell range
Value of sRange = B11:R11
Value of sumRowEnd = 20
-
Aug 5th, 2012, 09:17 PM
#44
Re: SUM of selected cell range
Hi Ria,
which line gives error? can u attach the file u tried?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|