Hi
I would like to copy the format of the cells. It relates to just one particular line in my VBA code but I'm unsure how to add in the code to do this. I only want the formats copied for the final line of my code,
,
the main code is below, Is anyone able to help me with this?
I would like to copy the format of the cells. It relates to just one particular line in my VBA code but I'm unsure how to add in the code to do this. I only want the formats copied for the final line of my code,
VBA Code:
Ws4.Range("A2:C22").Offset(lngrow2, 0).Value = ws.Range("I63:K83").Value
the main code is below, Is anyone able to help me with this?
VBA Code:
Set ws = Wb.Sheets("Total Quantities")
On Error GoTo 0
If Not ws Is Nothing Then
If lngrow1 = 0 Then
lngrow1 = 5
Else
lngrow2 = lngrow2 + 22
lngrow1 = lngrow1 + 1
lngrow = lngrow + 284
End If
ws1.Cells(lngrow1, "A").Value = ws.Range("A1").Value
ws1.Cells(lngrow1, "B").Value = ws.Range("I2").Value
ws1.Cells(lngrow1, "C").Value = ws.Range("C2").Value
ws1.Cells(lngrow1, "E").Value = ws.Range("C3").Value
ws1.Cells(lngrow1, "G").Value = ws.Range("C4").Value
ws2.Cells(lngrow1, "B").Value = ws.Range("B8").Value
ws2.Cells(lngrow1, "C").Value = ws.Range("B9").Value
ws2.Cells(lngrow1, "D").Value = ws.Range("B10").Value
ws2.Cells(lngrow1, "E").Value = ws.Range("B11").Value
ws2.Cells(lngrow1, "F").Value = ws.Range("B12").Value
ws2.Cells(lngrow1, "G").Value = ws.Range("B13").Value
ws2.Cells(lngrow1, "H").Value = ws.Range("B14").Value
ws3.Range("A2:A228").Offset(lngrow, 0).Value = ws.Range("A16:A242").Value
ws3.Range("B2:B228").Offset(lngrow, 0).Value = ws.Range("C16:C242").Value
ws3.Range("E2:E228").Offset(lngrow, 0).Value = ws.Range("H16:H242").Value
ws3.Range("D2:D228").Offset(lngrow, 0).Value = ws.Range("E16:E242").Value
ws3.Range("F2:F228").Offset(lngrow, 0).Value = ws.Range("F16:F242").Value
ws3.Range("A229:A275").Offset(lngrow, 0).Value = ws.Range("I16:I62").Value
ws3.Range("b229:b275").Offset(lngrow, 0).Value = ws.Range("J16:J62").Value
ws3.Range("d229:d275").Offset(lngrow, 0).Value = ws.Range("K16:K62").Value
ws3.Range("e229:e275").Offset(lngrow, 0).Value = ws.Range("l16:l62").Value
ws3.Range("A276:A284").Offset(lngrow, 0).Value = ws.Range("I64:I72").Value
ws3.Range("b276:b284").Offset(lngrow, 0).Value = ws.Range("J64:J72").Value
ws3.Range("d276:d284").Offset(lngrow, 0).Value = ws.Range("K64:K72").Value
Ws4.Range("A2:C22").Offset(lngrow2, 0).Value = ws.Range("I63:K83").Value
End If
.Close
End With
Next i
Cleanup:
Set fldr = Nothing
End Sub