I have categories as listed in columns: Company name, 1st name, last name, number of units, unit 1, unit 2, unit 3, unit 4, family, email, etc. Each company has its on row. However some companies can have multiple units at the same time. I want to separate the companies by their units.
Picture of Sheet1.
When I start the VBA code, I want it to be copied to Sheet2 to look like the 2nd picture.
Everything on the spreadsheets are made up.
My code displaces the columns but doesn't condense the columns I want into one column.
Also, I don't know how to copy from sheet to sheet.
Sub Button2_Click()
Dim cr As Long 'current row
Dim cc As Long 'current column
For cr = 2 To 11
For cc = 8 To 11 Step 2
If Cells(cr, cc).Value = "R" Then
'make column 13 (M) in current row = unit
Cells(cr, 13).Value = Cells(1, cc).Value
End If
Next
Next
End Sub