I found some info on the forum but I haven't been able to understand it. I need to copy specific rows (range) in sequence from one excel sheet to a new sheet for data plotting. Can someone please help me with this visual basic code?
My data looks like this: https://i.stack.imgur.com/VACgN.jpg
What I need to do is combine A1-1:E1-1
and A1-2:E1-2
data side by side, as in I want D5:D9
side by side with D19:D23
. Similarly, E5:E9
side by side with E19:E23
. These combinations can be done by creating a new sheet I hope.
Then I think I need to run a loop to combine A2-1
and A2-2
data. A2
data starts at row 32. This spacing is maintained throughout the spreadsheet. so I think one should be able to put in a loop to go through the entire sheet. There are spaces in between data (rows), so I am not sure as to how you would tell the program to run through the entire sheet.
sub copydata()
LastRow = ActiveSheet.Range("A" & Rows.Count).End(xlUp).row
For i = 8 To LastRow
Range(Cells(i, 1), Cells(i, 4)).Select
Selection.Copy
erow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).row
ActiveSheet.Cells(erow, 1).Select
ActiveSheet.Paste
ActiveWorkbook.Save
ActiveWorkbook.Close
Application.CutCopyMode = False
End If
Next i
End Sub