PDA

View Full Version : Re-populating cells



boxcaru
02-02-2006, 02:19 AM
Hello,

Is there a way to click a button which selects a row of data and copies it into another workbook, with the data not in one row? i.e scattered around the page?

thanks

Bob Phillips
02-02-2006, 02:29 AM
Hello,

Is there a way to click a button which selects a row of data and copies it into another workbook, with the data not in one row? i.e scattered around the page?

thanks

Off the top, not tested


Sub CopyData()
Dim i As Long
Dim cell As Range

For Each cell In Selection
i = i + 1
cell.copy Worksheets("Sheet2").Range("A" & i)
Next cell

End Sub


Select all your cells to copy using Ctrl-Click, and then run the macro.