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

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

tmcfadden

Board Regular
Joined
Aug 17, 2005
Messages
151
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
 

Forum statistics

Threads
1,136,647
Messages
5,676,983
Members
419,667
Latest member
MegEri

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
Top