Find Change In Cell Contents

bobkap

Active Member
Joined
Nov 22, 2009
Messages
323
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:

[TABLE="width: 377"]
<colgroup><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Customer[/TD]
[TD]Category[/TD]
[TD] Date[/TD]
[TD]Code[/TD]
[TD] Amount Paid [/TD]
[/TR]
[TR]
[TD]Bonneville Co.[/TD]
[TD]A[/TD]
[TD="align: right"]12/22/2017[/TD]
[TD]BG[/TD]
[TD] $35.00[/TD]
[/TR]
[TR]
[TD]Bracketts[/TD]
[TD]R[/TD]
[TD="align: right"]12/5/2017[/TD]
[TD]BC[/TD]
[TD] $48.00[/TD]
[/TR]
[TR]
[TD]Bracketts[/TD]
[TD]A[/TD]
[TD="align: right"]12/12/2017[/TD]
[TD]BC[/TD]
[TD] $112.00[/TD]
[/TR]
[TR]
[TD]Campus Center[/TD]
[TD]G[/TD]
[TD="align: right"]12/21/2017[/TD]
[TD]CS [/TD]
[TD] $120.00[/TD]
[/TR]
[TR]
[TD]Campus Center[/TD]
[TD]G[/TD]
[TD="align: right"]12/22/2017[/TD]
[TD]CS [/TD]
[TD] $361.00[/TD]
[/TR]
[TR]
[TD]Campus Center[/TD]
[TD]H[/TD]
[TD="align: right"]12/21/2017[/TD]
[TD]CS [/TD]
[TD] $220.00[/TD]
[/TR]
[TR]
[TD]Campus Center[/TD]
[TD]D[/TD]
[TD="align: right"]12/12/2017[/TD]
[TD]CS [/TD]
[TD] $200.00[/TD]
[/TR]
[TR]
[TD]Campus Center[/TD]
[TD]L[/TD]
[TD="align: right"]12/12/2017[/TD]
[TD]CS [/TD]
[TD] $200.00[/TD]
[/TR]
[TR]
[TD]Lowell Inc.[/TD]
[TD]A[/TD]
[TD="align: right"]12/9/2017[/TD]
[TD]LO[/TD]
[TD] $110.00[/TD]
[/TR]
[TR]
[TD]Lowell Inc.[/TD]
[TD]S[/TD]
[TD="align: right"]12/9/2017[/TD]
[TD]LO[/TD]
[TD] $110.00[/TD]
[/TR]
[TR]
[TD]Lowell Inc.[/TD]
[TD]C[/TD]
[TD="align: right"]12/8/2017[/TD]
[TD]LO[/TD]
[TD] $110.00[/TD]
[/TR]
[TR]
[TD]Lowell Inc.[/TD]
[TD]D[/TD]
[TD="align: right"]12/8/2017[/TD]
[TD]LO[/TD]
[TD] $110.00
[/TD]
[/TR]
</tbody>[/TABLE]

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

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
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,223,708
Messages
6,174,006
Members
452,542
Latest member
Bricklin

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