• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Partial Paste Transpose

sms2luv

Member
I receive a roster file From WFM team(work force management) in the format attched
I want to converted it to a different format for reports.
I want to converted it like the way it is in Output Sheet.
Please help with VBA code, I think we could call it as partial paste transpose.
paperclip.png
Attached Files
 

Attachments

  • Roster_Upload.xls
    15 KB · Views: 4
Try this.

Code:
Option Explicit

Sub PartialTranspose()
Dim vIn As Variant
Dim rO As Long, cO As Long, rI As Long, cI As Long
' 1 2 3 4 5 6 7 8 etc.
'Emp I'd CTI Name Team Lob 1-Aug 2-Aug 3-Aug
vIn = Worksheets("Roster").Cells(2, 1).CurrentRegion.Value

' 1 2 3 4 5 6 7
'Date Emp I'd CTI Name Team Lob Shift time
With Worksheets("Output")
rO = 2
.Cells(rO, 1).Value = "Date"
.Cells(rO, 2).Value = "Emp I'd"
.Cells(rO, 3).Value = "CTI"
.Cells(rO, 4).Value = "Name"
.Cells(rO, 5).Value = "Team"
.Cells(rO, 6).Value = "Lob"
.Cells(rO, 7).Value = "Shift time"

rO = rO + 1

For rI = 2 To UBound(vIn, 1)
For cI = 6 To UBound(vIn, 2)
.Cells(rO, 1).Value = vIn(1, cI)
.Cells(rO, 2).Value = vIn(rI, 1)
.Cells(rO, 3).Value = vIn(rI, 2)
.Cells(rO, 4).Value = vIn(rI, 3)
.Cells(rO, 5).Value = vIn(rI, 4)
.Cells(rO, 6).Value = vIn(rI, 5)
.Cells(rO, 7).Value = vIn(rI, cI)

rO = rO + 1
Next cI
Next rI
End With
End Sub
 
Back
Top