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

VBA code to get specific cell data from one cell (Sheet1) to another (Sheet2).

Jagdev Singh

Active Member
Hi Expert
I have received a huge list of unorganized data which I need to organized and place it in sheet2 of the sample file. I tried to create the replica of the original doc in the sample file and provide 2 examples in Sheet1. The data is huge and it is continued. I am aware of excel formula but the data is not placed in proper order, it is hectic to apply formula from sheet1 to sheet2. Could you please help me with the VBA code to make the process automate.
Regards,
JD
 

Attachments

  • sample_data.xlsx
    11.1 KB · Views: 0
Hi All

I find the below code and it fits into my requirement.

Code:
Sub CopyEm()
Dim i As Long
Dim dr As Long
For i = 15 To Cells(Rows.Count, 1).End(xlUp).Row Step 7
dr = Sheet2.Cells(Rows.Count, 1).End(xlUp).Row + 1
With Sheet2
.Cells(dr, 1).Value = Cells(i, 1).Value
.Cells(dr, 2).Value = Cells(i, 4).Value
.Cells(dr, 3).Value = Cells(i + 2, 1).Value
'preforemat sh2.column D as Date desired
.Cells(dr, 4).Value = Left(Cells(i + 5, 1), 6)
.Cells(dr, 5).Value = Cells(i + 1, 1).Value
.Cells(dr, 6).Value = Cells(i, 19).Value
End With
Next i
End Sub

Regards,
JD
 
Back
Top