Userform Textbox code for autofiltered worksheet?

Big Lar

Well-known Member
Joined
May 19, 2002
Messages
557
If I could figure out the code, maybe I could eliminate Sheet2 from my project?<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
Sheet2 provides calculated column subtotals from AutoFiltered Sheet1.<o:p></o:p>
<o:p></o:p>
Currently, I use this:<o:p></o:p>
TextBox1.Value = (Format(Sheet2.Range("M16").Value + (Sheet2.Range("N16").Value), "$ #.00"))<o:p></o:p>
<o:p></o:p>
Where Sheet2<o:p></o:p>
M16 formula is =SUBTOTAL(9,Sheet1!T:T) and<o:p></o:p>
N16 formula is =SUBTOTAL(9,Sheet1!U:U)/4<o:p></o:p>
<o:p></o:p>
I struggle with the proper expressions to make this work.<o:p></o:p>
TextBox1.Value = (Format(Subtotal(9, Sheet1.Range("T:T").Value +(Subtotal(9,Sheet1.Range(“U:U”)/4.Value), "$ #.00"))<o:p></o:p>
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Try...

Code:
[font=Verdana]    [color=darkblue]Dim[/color] MyTotal [color=darkblue]As[/color] [color=darkblue]Double[/color]
    
    [color=darkblue]With[/color] Application.WorksheetFunction
        MyTotal = .Subtotal(9, Sheet1.Range("T:T")) + .Subtotal(9, Sheet1.Range("U:U")) / 4
    [color=darkblue]End[/color] [color=darkblue]With[/color]
        
    TextBox1.Value = Format(MyTotal, "$ #,###.00")
    [/font]
 
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,850
Members
452,948
Latest member
UsmanAli786

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