Center for Research in LanguageUCSD
CRL
Web

Lab Handbook

Excel Macros

This is a sample macro that takes a block of data and steps it down in your worksheet 10 times. You can modify this to fit your needs. You will need to change a few variables to make this work.

The code is listed below. To save this, click the link, then choose save from your web browser. You can import this into any Excel workbook.

sample.bas

  For i = 1 To 10
' get your current x,y coordinates
    x = ActiveCell.Column
    y = ActiveCell.Row
' specify the size of your data block
    datarows = 3
    datacolumns = 8
' select the range of data to cut
    Range(Cells(y, x), Cells(y + datarows - 1, x + datacolumns - 1)).Select
    Selection.Cut 
' move to your new location to paste 
    Cells(y + datarows, x).Select
    ActiveSheet.Paste
' set the selection to the start of the next data block 
    Cells(y + datarows, x).Select
  Next i