Hi guys,
I'm new to VBA macros and cannot figure out a way to add a loop to my macro.
I have data output from an experiment and want to do the following:
Any help would be very much appreciated.
Warm regards
Kruggie
I'm new to VBA macros and cannot figure out a way to add a loop to my macro.
I have data output from an experiment and want to do the following:
- Copy/paste data from sheet "Data" to sheet "Summary" (see below code).
- Loop with an offset of 130 rows.
- The paste function should select the next empty row on the "Summary" sheet.
Any help would be very much appreciated.
Warm regards
Kruggie
Code:
Sub LM_data()
'animal_ID
Worksheets("Data").Range("C23").Copy Worksheets("Summary").Range("A2")
'group
Worksheets("Data").Range("C25").Copy Worksheets("Summary").Range("C2")
'1_dist_cm
Worksheets("Data").Range("A99").Copy Worksheets("Summary").Range("D2")
'2_dist_cm
Worksheets("Data").Range("A100").Copy Worksheets("Summary").Range("E2")
'total_dist_cm
Worksheets("Data").Range("A102").Copy Worksheets("Summary").Range("F2")
'1_amb_time
Worksheets("Data").Range("B99").Copy Worksheets("Summary").Range("G2")
'2_amb_time
Worksheets("Data").Range("B100").Copy Worksheets("Summary").Range("H2")
'total_amb_time
Worksheets("Data").Range("B102").Copy Worksheets("Summary").Range("I2")
'1_rest_time
Worksheets("Data").Range("F99").Copy Worksheets("Summary").Range("J2")
'2_rest_time
Worksheets("Data").Range("F100").Copy Worksheets("Summary").Range("K2")
'total_rest_time
Worksheets("Data").Range("F102").Copy Worksheets("Summary").Range("L2")
'zone_1_time
Worksheets("Data").Range("J99").Copy Worksheets("Summary").Range("M2")
'zone_2_time
Worksheets("Data").Range("J100").Copy Worksheets("Summary").Range("N2")
'total_time
Worksheets("Data").Range("J102").Copy Worksheets("Summary").Range("O2")
End Sub
Last edited by a moderator: