VBA: how to enter this formula

yky

Well-known Member
Joined
Jun 7, 2011
Messages
1,881
Office Version
  1. 2010
Platform
  1. Windows
I need to calculate the sum of a range. It looks to me range.subtotal is the way to do it. The problem is I don't know how to use it. I did an Internet set but found no detailed instruction. The next thing I tried is to insert a "=sum" formula to a cell in a spreadsheet. I have a problem with this also. How do I do the following? Thanks.

[E65536].End(xlUp).Offset(3, 0).Formula = "=sum(E6:" & [E65536].End(xlUp) & ")"
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
To get the row use this:

Code:
Range("E" & Rows.count).End(xlup).Row

I hope this should give an idea on what you are suppose to do!!
 
Upvote 0
This is how your formula would look like:

Code:
Range("E65536").End(xlUp).Offset(3, 0).Formula = "=sum(E6:E" & Range("E65536").End(xlUp).Row & ")"
 
Upvote 0
Or maybe this

[E65536].End(xlUp).Offset(3, 0).Formula = "=sum(E6:" & [E65536].End(xlUp).Address & ")"

M.
 
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,798
Members
452,943
Latest member
Newbie4296

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top