• 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.

Transfer from sheet 1 to sheet 2 with column swap

Belleke

Well-Known Member
Hi,
I am looking for some code to transfer data from Sheet 1 to sheet 2 when value in column E is ready.
But two difficulties
The transfer should start at row 10 and values from column G should go to Column F
See example

Thanks
 

Attachments

  • Chandoo example.xlsm
    16.2 KB · Views: 6
Marc en Ankushrs1,
Thank you for your time and advice but I am looking for a VBA solution.
 
try below...
Code:
Sub tnf_dt()
Dim lstrw1, lstrw2, i As Long
Dim dt_sht, hst_sht As Worksheet
Set dt_sht = Worksheets("Data")
Set hst_sht = Worksheets("History")
lstrw1 = dt_sht.Cells(dt_sht.Cells.Rows.Count, 2).End(xlUp).Row
For i = 2 To lstrw1
lstrw2 = hst_sht.Cells(hst_sht.Cells.Rows.Count, 2).End(xlUp).Row + 1
If dt_sht.Range("e" & i).Value = "Ready" Then
hst_sht.Range("B" & lstrw2).Value = dt_sht.Range("b" & i).Value
hst_sht.Range("C" & lstrw2).Value = dt_sht.Range("C" & i).Value
hst_sht.Range("F" & lstrw2).Value = dt_sht.Range("G" & i).Value
hst_sht.Range("D" & lstrw2).Value = "Done"
End If
Next
End Sub

let me know if any flaw in this code
 
Back
Top