Selction.group number formatting

Mr_Ragweed

Board Regular
Joined
Dec 10, 2012
Messages
74
Hello all. I'm looking to do a number format on the data in a pivot table grouping. Currently when you Group the data each range is filled with decimals
(Excel 2010)
I would like the ranges to be 0.15-0.23 vs 0.152222222222222-0.232222222222222 which is what i get (by the way i dont want those exact ranges, this is just an example).
The grouping is done via a userform where the user inputs the "By" increments. I have tried inserting NumberFormat = "0.00" in various places but to no avail. "Start" and "End" are never known, therefore i just left them as true. Would a LEN statement of some kind where i just pull the data up to the first two decimals be the way to go? Each pivot table is obviously of different length and each time it is regrouped the length will be changed so i think grabbing the "End" would be difficult if even possible.
Sample code below:
Code:
Private Sub CmdRegroup_Click()
Dim FinalRow As Long
FinalRow = ActiveSheet.Cells(Application.Rows.Count, 1).End(xlUp).Row
        If TextBox1.Value = True Then
        
            If Range("I13").Value = "List" Then
    Cells(4, 6).Select
    Selection.Group Start:=True, End:=True, By:=TextBox1.Value
            ElseIf Range("N13").Value = "List" Then
            Cells(4, 11).Select
            Selection.Group Start:=True, End:=True, By:=TextBox1.Value
                ElseIf Range("J13").Value = "List" Then
                Cells(4, 7).Select
                Selection.Group Start:=True, End:=True, By:=TextBox1.Value
                    ElseIf Range("O13").Value = "List" Then
                    Cells(4, 12).Select
                    Selection.Group Start:=True, End:=True, By:=TextBox1.Value
             End If
        End If
Unload Me
End Sub
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Forum statistics

Threads
1,214,979
Messages
6,122,561
Members
449,089
Latest member
Motoracer88

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