Align excel data format to use bulk pdf free software
I track equipment in our office and who and what cubicle its assigned to in excel I attempting to automate creating a pdf for each person with their equipment.
This information needs to go into a pdf for each person, but a person will have multiple pieces of equipment (A person can have 3 to 8 pieces of equipment).
For the final product, I would have a pdf which list the equipment for that person. and Have a pdf for each person.
Bulk PDf can do the pdf side if I can align the data in the format needed.
Desired format:
Copy from original sheet to a sheet where a persons equipment is on one row.
Alice on row 1
Bob on row 2, etc.
Sample Data:
Desired New Sheet Example:
Row "1" Title row (Denotes Columns Letters):
Row "2" (will contain all of Alices Equipment):
Row "3" (will contain all of Bobs Equipment):
etc.
Its not important that information repeats in columns in the new sheet as the bulk pdf software can handle this, I just needs a singles person equipment on 1 row, a different persons equipment on row 2, etc.
Copying the row seems easier than extracting the data needed (since the bulk pdf software handles it).
Im attempting to modify this array which put everyone on a new sheets in a similar format (each equipment has its own row, as opposed to each person having a row with all their equipment). I dont know vba well enough to modify this code.
I need to compare the names and if they are the same, copy the row to a sheet such that a user is on a single row, all users on the same sheet.
Bulk PDF creates pdf based on rows, and fills the data based on columns.
Code:
I track equipment in our office and who and what cubicle its assigned to in excel I attempting to automate creating a pdf for each person with their equipment.
This information needs to go into a pdf for each person, but a person will have multiple pieces of equipment (A person can have 3 to 8 pieces of equipment).
For the final product, I would have a pdf which list the equipment for that person. and Have a pdf for each person.
Bulk PDf can do the pdf side if I can align the data in the format needed.
Desired format:
Copy from original sheet to a sheet where a persons equipment is on one row.
Alice on row 1
Bob on row 2, etc.
Sample Data:
Equipment Serial Number | Persons Name | Cubicle |
RandomSerial1 | Alice Andrews | 1 |
RandomSerial2 | Alice Andrews | 1 |
RandomSerial3 | Bob Bones | 2 |
RandomSerial4 | Bob Bones | 2 |
RandomSerial5 | Charles Carter | 3 |
RandomSerial6 | Charles Carter | 3 |
Desired New Sheet Example:
Row "1" Title row (Denotes Columns Letters):
(A)Equipment Serial Number | (B)Persons Name | (C)Cubicle | (D)Equipment Serial Number | (E)Persons Name | (F)Cubicle |
RandomSerial1 | Alice Andrews | 1 | RandomSerial2 | Alice Andrews | 1 |
RandomSerial3 | Bob Bones | 2 | RandomSerial4 | Bob Bones | 2 |
RandomSerial5 | Charles Carter | 3 | RandomSerial6 | Charles Carter | 3 |
Row "3" (will contain all of Bobs Equipment):
etc.
Its not important that information repeats in columns in the new sheet as the bulk pdf software can handle this, I just needs a singles person equipment on 1 row, a different persons equipment on row 2, etc.
Copying the row seems easier than extracting the data needed (since the bulk pdf software handles it).
Im attempting to modify this array which put everyone on a new sheets in a similar format (each equipment has its own row, as opposed to each person having a row with all their equipment). I dont know vba well enough to modify this code.
I need to compare the names and if they are the same, copy the row to a sheet such that a user is on a single row, all users on the same sheet.
Bulk PDF creates pdf based on rows, and fills the data based on columns.
Code:
VBA Code:
Sub parse_data()
Dim lr As Long
Dim ws As Worksheet
Dim vcol, i As Integer
Dim icol As Long
Dim myarr As Variant
Dim title As String
Dim titlerow As Integer
'This macro splits data into multiple worksheets based on the variables on a column found in Excel.
'An InputBox asks you which columns you'd like to filter by, and it just creates these worksheets.
Application.ScreenUpdating = False
vcol = Application.InputBox(prompt:="Which column would you like to filter by?", title:="Filter column", Default:="3", Type:=1)
Set ws = ActiveSheet
lr = ws.Cells(ws.Rows.Count, vcol).End(xlUp).Row
title = "A1"
titlerow = ws.Range(title).Cells(1).Row
icol = ws.Columns.Count
ws.Cells(1, icol) = "Unique"
For i = 2 To lr
On Error Resume Next
If ws.Cells(i, vcol) <> "" And Application.WorksheetFunction.Match(ws.Cells(i, vcol), ws.Columns(icol), 0) = 0 Then
ws.Cells(ws.Rows.Count, icol).End(xlUp).Offset(1) = ws.Cells(i, vcol)
End If
Next
myarr = Application.WorksheetFunction.Transpose(ws.Columns(icol).SpecialCells(xlCellTypeConstants))
ws.Columns(icol).Clear
For i = 2 To UBound(myarr)
ws.Range(title).AutoFilter field:=vcol, Criteria1:=myarr(i) & ""
If Not Evaluate("=ISREF('" & myarr(i) & "'!A1)") Then
Sheets.Add(after:=Worksheets(Worksheets.Count)).Name = myarr(i) & ""
Else
Sheets(myarr(i) & "").Move after:=Worksheets(Worksheets.Count)
End If
ws.Range("A" & titlerow & ":A" & lr).EntireRow.Copy Sheets(myarr(i) & "").Range("A1")
'Sheets(myarr(i) & "").Columns.AutoFit
Next
ws.AutoFilterMode = False
ws.Activate
Application.ScreenUpdating = True
End Sub