ThrottleWorks
Excel Ninja
How to improve below mentioned code. Please note I will be uploading a sample file shortly (Only then the code will make any sense).
Code:
'Copying and spliting multiple records
Dim FreqRng As Range
Set FreqRng = TempSht.Range(TempSht.Cells(2, 12), TempSht.Cells(TempLr, 12))
'FreqRng.Select
For Each Rng In FreqRng
TLr = Data.Cells(Rows.Count, 1).End(xlUp).Row + 1
Rng.Offset(0, -11).Select
ActiveCell.Resize(1, 9).Copy
TempSht.Range(TempSht.Cells(1, 16), TempSht.Cells(Rng + 1, 16)).PasteSpecial
FreqLr = TempSht.Cells(Rows.Count, 16).End(xlUp).Row
TempSht.Range(TempSht.Cells(1, 21), TempSht.Cells(Rng, 21)).Value = Rng.Offset(0, 1)
TempSht.Cells(FreqLr, 21).Value = Rng.Offset(0, 2)
TempSht.Range("P1").CurrentRegion.Copy Destination:=Data.Cells(TLr, 1)
TempSht.Range("P1").CurrentRegion.Clear
Next
Attachments
Last edited: