Dec 13 2022 03:14 PM
Hi I have a very large report that lists what I need to charge clients in Quickbooks for the month. It has each service call listed separately, what services, the amount of time, Date, who requested etc. I need to create a new workbook if possible, or just a new page, for each client that copies all of their rows/columns. I am sure there is a way to do this with functio
Here is an example of what I have now, and what I need it to be.
Original Report:
Cust_No | Cust Name | Date | Order Number | Start Time | Total Min |
1 | ABC Co | 1-1-2022 | 22252 | 12:00 | 5 |
1 | ABC Co | 1-8-22 | 22586 | 1:00 | 45 |
1 | ABC Co | 1-18-22 | 22599 | 10:00 | 7 |
8 | Pretend Co | 1-7-22 | 25894 | 9:00 | 48 |
8 | Pretend Co | 1-25-22 | 25987 | 1:00 | 36 |
25 | Ziggly Zoo | 1-25-22 | 26798 | 4:00 | 98 |
Need Separate Reports or Pages for each customer like this:
Cust_No | Cust Name | Date | Order Number | Start Time | Total Min |
1 | ABC Co | 1-1-2022 | 22252 | 12:00 | 5 |
1 | ABC Co | 1-8-22 | 22586 | 1:00 | 45 |
1 | ABC Co | 1-18-22 | 22599 | 10:00 | 7 |
Cust_No | Cust Name | Date | Order Number | Start Time | Total Min |
8 | Pretend Co | 1-7-22 | 25894 | 9:00 | 48 |
8 | Pretend Co | 1-25-22 | 25987 | 1:00 | 36 |
I would prefer to have it copy the info vs move/delete it so that I can double check and have the original information as it is provided to me from the company but that is not a huge issue as I can always just save a copy before doing anything with functions etc.
Dec 13 2022 06:21 PM
@Bumblina To create separate sheet you need VBA macro. Function can display output results only. Use below macro. Download the attached file and add more data then test.
Sub ProcessData()
Dim LastRow As Long, zLastRow As Long
Dim ws As Worksheet
Dim Rng As Range, zRng As Range, cel As Range
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
Set Rng = Range("A1:A" & LastRow)
'Copy uniqe customer no to temp location Z1.
Range("Z1").CurrentRegion.Clear
Rng.AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range("Z1"), Unique:=True
zLastRow = Cells(Rows.Count, "Z").End(xlUp).Row
Set zRng = Range("Z2:Z" & zLastRow)
Application.ScreenUpdating = False
'Create sheets with all customer no.
For Each cel In zRng
ThisWorkbook.Sheets.Add(After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)).Name = cel
Next cel
DoEvents 'Release current operation for a while and give control to processor
Sheet1.Activate 'Go back to first sheet
'Copy data from first sheet to other sheets.
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> ActiveSheet.Name Then
ActiveSheet.Range("A1").CurrentRegion.AutoFilter Field:=1, Criteria1:=ws.Name
ActiveSheet.Range("A1").CurrentRegion.SpecialCells(xlCellTypeVisible).Copy Sheets(ws.Name).Range("A1")
ActiveSheet.Range("A1").CurrentRegion.AutoFilter
ws.Columns.AutoFit
End If
Next ws
Application.ScreenUpdating = True
'Clear/Empty memories
Range("Z1").CurrentRegion.Clear
Set Rng = Nothing
Set zRng = Nothing
End Sub