Find Change In Cell Contents

bobkap

Active Member
Joined
Nov 22, 2009
Messages
313
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
  3. Web
I have many rows of data that I need to break-up by customer and move to another worksheet so that each customer has their own sheet. I've figured out how to create the new sheets and move the data, but I'm lost as to how to copy rows of data for just one customer at a time. Here's an example of what my data looks like:

CustomerCategory DateCode Amount Paid
Bonneville Co.A12/22/2017BG $35.00
BrackettsR12/5/2017BC $48.00
BrackettsA12/12/2017BC $112.00
Campus CenterG12/21/2017CS $120.00
Campus CenterG12/22/2017CS $361.00
Campus CenterH12/21/2017CS $220.00
Campus CenterD12/12/2017CS $200.00
Campus CenterL12/12/2017CS $200.00
Lowell Inc.A12/9/2017LO $110.00
Lowell Inc.S12/9/2017LO $110.00
Lowell Inc.C12/8/2017LO $110.00
Lowell Inc.D12/8/2017LO $110.00

<colgroup><col><col><col><col><col></colgroup><tbody>
</tbody>

i thought I might use the sub-total function to separate the companies, but then I'm puzzled as to how I capture just one company's rows of data at a time to copy and paste to another sheet.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
How about
Code:
Sub AddSht_FltrPaste()
   
   Dim Cl As Range
   Dim UsdRws As Long
   Dim OSht As Worksheet
   
Application.ScreenUpdating = False
   
   Set OSht = Sheets("[COLOR=#ff0000]Sheet1[/COLOR]")
   UsdRws = OSht.Range("A" & Rows.Count).End(xlUp).Row
   OSht.Range("A1").AutoFilter
   
   With CreateObject("scripting.dictionary")
      For Each Cl In Range("A2:A" & UsdRws)
         If Not .exists(Cl.Value) Then
            .Add Cl.Value, Nothing
            OSht.Range("A1:G" & UsdRws).AutoFilter Field:=1, Criteria1:=Cl.Value
            Sheets.Add(After:=Sheets(Sheets.Count)).Name = Cl.Value
            OSht.Range("A1:A" & UsdRws).SpecialCells(xlCellTypeVisible).EntireRow.Copy _
               Sheets(Cl.Text).Range("A1")
         End If
      Next Cl
   End With
   OSht.Range("A1").AutoFilter
   
End Sub
This will add the sheets & copy the relevant data over.
Change sheet name in red to suit
 
Upvote 0
WOW! Nice! That works perfectly. Thanks very much!!

I've never done something like your "CreateObject("scripting.dictionary")" If you don't mind, can you please tell me what that does? Where does that scripting.dictionary exist? OR, is that some kind of function I need to learn?
 
Upvote 0

Forum statistics

Threads
1,214,812
Messages
6,121,704
Members
449,048
Latest member
81jamesacct

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