Hi, the below code copies data from from sheet("Raw") to Sheet("Final"), is this the correct method in copying or is there a better solution.
Also i want to add this
.NumberFormat = "#,##0.00_);[Red](#,##0.00)"
to DestAmount, how can i do that?
.Range(AmountRng & lstRow).Copy Destination:=Sheets(ShtFinal).Range(DestAmount)
Also i want to add this
.NumberFormat = "#,##0.00_);[Red](#,##0.00)"
to DestAmount, how can i do that?
.Range(AmountRng & lstRow).Copy Destination:=Sheets(ShtFinal).Range(DestAmount)
Code:
Sub Test()
Const ShtRaw = "Raw"
Const ShtFinal = "Final"
Const AmountRng = "G6:G"
Const CCYRng = "H6:H"
Const DateRng = "E6:E"
Const AccountRng = "C6:C"
Const TypeRng = "F6:F"
Const SourceRng = "J6:J"
Const DestAmount = "A2"
Const DestCCY = "B2"
Const DestDate = "C2"
Const DestAccount = "D2"
Const DestType = "E2"
Const DestSource = "F2"
Dim lstRow As Long
With Sheets(ShtRaw)
lstRow = .Range("A" & Rows.Count).End(xlUp).Row
.Range(AmountRng & lstRow).Copy Destination:=Sheets(ShtFinal).Range(DestAmount)
.Range(CCYRng & lstRow).Copy Destination:=Sheets(ShtFinal).Range(DestCCY)
.Range(DateRng & lstRow).Copy Destination:=Sheets(ShtFinal).Range(DestDate)
.Range(AccountRng & lstRow).Copy Destination:=Sheets(ShtFinal).Range(DestAccount)
.Range(TypeRng & lstRow).Copy Destination:=Sheets(ShtFinal).Range(DestType)
.Range(SourceRng & lstRow).Copy Destination:=Sheets(ShtFinal).Range(DestSource)
End With
End Sub