Creating new 'sheet' based on data in a cell

dmfweb

New Member
Joined
Mar 14, 2014
Messages
34
Office Version
  1. 365
I don't THINK this can be done, but I have seen some pretty amazing things here.

I have some data like below:
Field 1LocationField 3Field 4
abcLocation ABC2321446436
2323Location DEF3434464364
2323Location GHI3343113446534
13213Location DEF34332432


Is it possible to create a new sheet per location and all the lines with that location would be on it. The data is about 15,000 lines with close to 50 locations. I know it can be done in a pivot table and then I could click on each grouping which will create a new sheet, but I would like this done simpler. IF possible...

Appreciate you!
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Try:
VBA Code:
Sub CreateSheets()
    Application.ScreenUpdating = False
    Dim v As Variant, i As Long, dic As Object, srcWS As Worksheet
    Set srcWS = Sheets(1)
    v = srcWS.Range("B2", srcWS.Range("B" & Rows.Count).End(xlUp)).Value
    Set dic = CreateObject("Scripting.Dictionary")
    For i = LBound(v) To UBound(v)
        If Not dic.exists(v(i, 1)) Then
            dic.Add v(i, 1), Nothing
            srcWS.Range("A1").CurrentRegion.AutoFilter 2, v(i, 1)
            Sheets.Add after:=Sheets(Sheets.Count)
            ActiveSheet.Name = v(i, 1)
            srcWS.AutoFilter.Range.Copy Range("A1")
        End If
    Next i
    srcWS.Range("A1").AutoFilter
    Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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