Subtotal Macro Help!

seenfresh

Well-known Member
Joined
Jul 12, 2006
Messages
1,141
I have a subtotal Macro that I have created for a subtotal function on my ToolBar Menu (thanks to texasalynn) as follows:

Sub AutoSubtotal_Formula()
Dim x As String
Dim y As String

x = ActiveCell.Offset(-1, 0).End(xlUp).Address
y = ActiveCell.Offset(-1, 0).Address

ActiveCell = "=SUBTOTAL(9," & x & ":" & y & ")"

End Sub

Is it possible to adjust this macro to input in Active Cell the same as above: ActiveCell = "=SUBTOTAL(9," & x & ":" & y & ")"

BUT can I have the Macro leave the cursor in the range criteria, thus I need the macro to input ="=SUBTOTAL(9,)" and leave the cursor in between the comma and ending ) * would this allow me to select my range everytime I used the Subtotal Function from my ToolBar much similar to the Auto Sum Function?

Any advice or Help would be much appreciated

Thanks in Advance,

"SEEN"
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
I'm pretty sure there's no easy way to do this.

You'd have to have some convoluted way of using the API to talk to the Excel window.

-Tim
 
Upvote 0

Forum statistics

Threads
1,214,622
Messages
6,120,576
Members
448,972
Latest member
Shantanu2024

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