Hi, krishnakuma6,
without seeing the original and the wanted outcome maybe check
Sub Test()
Dim lngN As Long
Dim lngM As Long
Dim ws1 As Worksheet
Dim wsM As Worksheet
Set ws1 = Sheets("Sheet1")
Set wsM = Sheets("Manpower")
With wsM
ws1.Cells.ClearContents
ws1.Cells(2, 1).Resize(1, 16).Value = .Range(.Cells(2, 2), .Cells(2, 17)).Value
ws1.Cells(2, 15) = "Contract code"
ws1.Cells(2, 16) = "Percentage"
For lngN = 3 To .Cells(Rows.Count, 1).End(xlUp).Row
If .Cells(lngN, 1).Value = "" Then Exit For
For lngM = 17 To .Cells(3, Columns.Count).End(xlToLeft).Column
If .Cells(lngN, lngM) <> "" Then
ws1.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Resize(1, 14).Value = .Range(.Cells(lngN, 2), .Cells(lngN, 15)).Value
ws1.Cells(Rows.Count, 1).End(xlUp).Offset(0, 14) = .Cells(2, lngM)
ws1.Cells(Rows.Count, 1).End(xlUp).Offset(0, 15) = .Cells(lngN, lngM)
End If
Next lngM
Next lngN
End With
Set wsM = Nothing
Set ws1 = nopthing
End Sub
Ciao,
Holger
Bookmarks