How to copy non blank data from sheet1 to sheet2 with VBA. Sometimes we may have incomplete data in our Excel worksheet. Now we would like to create a separate worksheet with only the complete data. With VBA we can copy the completed data from one worksheet to another quickly and easily. Watch the training video below:
You can view this video on YouTube also.
Here’s the complete VBA code to quickly copy the completed data:
Dim erow As Long, lastrow As Long, i As Long
If Sheet1.Cells(i, 1) <> “” Then
Sheets(“Sheet1”).Range(Cells(i, 1), Cells(i, 2)).Copy
erow = Sheet2.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
ActiveSheet.Paste Destination:=Sheets(“sheet2”).Range(Cells(erow, 1), Cells(erow, 2))