Requirement:
In the attached file, the user has highlighted a column yellow and wants to work on the data in that column.
The user wants to copy that data and paste that data to sheet2 each first empty row of each row.
See the Sample File in the link below:
Solution:
Sub CopyData()
Application.ScreenUpdating = False
Dim LastRow As Long
LastRow = Sheets("Sheet1").Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
Dim lColumn As Long
Dim mark As Range
For Each mark In Sheets("Sheet1").Range("C2:C" & LastRow)
lColumn = Sheets("Sheet2").Cells(mark.Row, Columns.Count).End(xlToLeft).Column + 1
Sheets("Sheet2").Cells(mark.Row, lColumn) = mark
Next mark
Application.ScreenUpdating = True
End Sub
Obtained from the OzGrid Help Forum.
Solution provided by Mumps.
See also: Index to Excel VBA Code and Index to Excel Freebies and Lesson 1 - Excel Fundamentals and Index to how to… providing a range of solutions and Index to new resources and reference sheets
See also:
| How to create a macro to copy and paste in the next empty row |
| How to use VBA code to copy rows from one sheet to another excluding empty rows |
| How to copy row data to empty rows beneath loop |
| How to create automatic removal of empty rows |
Click here to visit our Free 24/7 Excel/VBA Help Forum where there are thousands of posts you can get information from, or you can join the Forum and post your own questions.