Can someone help? (urgently needed)

rainx

Board Regular
Joined
Jul 4, 2008
Messages
210
Hi, I have a problem here, I have a list of entries of which has different group names. I need to sort them into various files based on their group name. In a way, doing filter, However, my concern is my group names will vary every month and I also need the files to be save respectively at a place with their group name. Kinda tough, Hope someone would be able to provide some advice. Wondering if it can just filter those that are in the list into different files instead of providing a fixed list to do for all each time. Please Help!

Thanks!
<!-- / message --> <!-- sig --> __________________
Cheers
Rainx
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Does your code look like this ?
Code:
Sub test()
Dim a, i As Long, ii As Long, w(), e, ws As Worksheet
Dim HeaderRow As Long
HeaderRow = 5
FilterCol=1
With ActiveSheet
    a = .Range("a1", .Cells.SpecialCells(11)).Value
End With
With CreateObject("Scripting.Dictionary")
    .CompareMode = vbTextCompare
    For i = HeaderRow + 1 To UBound(a,1)
        If Not IsEmpty(a(i,FilterCol)) Then
            If Not .exists(a(i,FilterCol)) Then
                ReDim w(1 To UBound(a,2), 1 To 1)
                For ii = 1 To UBound(a,2) : w(ii, 1) = a(i,ii) : Next
                .add a(i,FilterCol), w
            Else
                w = .item(a(i,FilterCol))
                ReDim Preserve w(1 To UBound(a,2), 1 To UBound(w,2) + 1)
                For ii = 1 To UBound(a,2) : w(ii, UBound(w,2)) = a(i,ii) : Next
               .item(a(i,FilterCol)) = w
            End If
        End If
    Next
    For Each e In .keys
        w = .item(e)
        On Error Resume Next
        Application.DisplayAlerts = False
        Sheets(e).Delete
        Application.DisplayAlerts = True
        On Error GoTo 0
        Set ws = Sheets.Add
        ws.Name = e
        ws.Cells(1).Resize(UBound(w,2), UBound(w,1)).Value = _
            Application.Transpose(w)
    Next
End With
End Sub
 
Upvote 0
Now can le! Thanks! :)

But den is it possible to duplicate the 1st 5 rows of the header to those split sheets too?

Thanks!
 
Upvote 0
change
Rich (BB code):
        ws.Name = e
        ws.Cells(1).Resize(UBound(w,2), UBound(w,1)).Value = _
            Application.Transpose(w)
to
Rich (BB code):
        ws.Name = e
        ws.Rows("1:5").Value = Me.Rows("1:5").Value
        ws.Cells(6,1).Resize(UBound(w,2), UBound(w,1)).Value = _
            Application.Transpose(w)
 
Upvote 0
1) change
Rich (BB code):
Dim a, i As Long, ii As Long, w(), e, ws As Worksheet
Dim HeaderRow As Long
to
Rich (BB code):
Dim a, i As Long, ii As Long, w(), e, ws As Worksheet
Dim HeaderRow As Long, myHeadings
2) change
Rich (BB code):
With ActiveSheet
    a = .Range("a1", .SpecialCells(11)).Value
End With
to
Rich (BB code):
With ActiveSheet
    a = .Range("a1", .SpecialCells(11)).Value
    myHeadings = .Rows("1:5").Value
End With
3) change
Rich (BB code):
        ws.Cells(1).Resize(UBound(w,2), UBound(w,1)).Value = _
            Application.Transpose(w)
to
Rich (BB code):
        ws.Rows("1:5").Value = myHeadings
        ws.Cells(1).Resize(UBound(w,2), UBound(w,1)).Value = _
            Application.Transpose(w)
 
Upvote 0
a = .Range("a1", .SpecialCells(11)).Value

Now this line gt problem...this error object doesnt support this property or method...

Thanks!
 
Upvote 0
a = .Range("a1", .SpecialCells(11)).Value

Now this line gt problem...this error object doesnt support this property or method...

Thanks!
Did it again
Rich (BB code):
        .Range("a1", .Cells.SpecialCells(11)).Value
 
Upvote 0

Forum statistics

Threads
1,216,178
Messages
6,129,325
Members
449,501
Latest member
Amriddin

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