Consulting

Results 1 to 2 of 2

Thread: Re-populating cells

  1. #1
    VBAX Regular
    Joined
    Jan 2006
    Posts
    8
    Location

    Re-populating cells

    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

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by boxcaru
    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

    [vba]
    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
    [/vba]

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •