Results 1 to 10 of 10

Loop to find a cell, then copy offset paste

Threaded View

mr.alexander Loop to find a cell, then... 02-01-2009, 07:06 PM
shg Re: Loop to find a cell, then... 02-01-2009, 07:33 PM
Strugglin Re: Loop to find a cell, then... 02-01-2009, 08:25 PM
solnajeff Re: Loop to find a cell, then... 02-01-2009, 09:04 PM
rylo Re: Loop to find a cell, then... 02-01-2009, 09:05 PM
mr.alexander Re: Loop to find a cell, then... 02-02-2009, 12:22 PM
mr.alexander Re: Loop to find a cell, then... 02-02-2009, 01:47 PM
Leith Ross Re: Loop to find a cell, then... 02-02-2009, 02:59 PM
wacholec1985 Re: Loop to find a cell, then... 01-29-2013, 08:23 AM
arlu1201 Re: Loop to find a cell, then... 01-29-2013, 08:48 AM
  1. #1
    Registered User
    Join Date
    02-01-2009
    Location
    Winnipeg, Canada
    MS-Off Ver
    Excel 2003
    Posts
    9

    Loop to find a cell, then copy offset paste

    Hello. Really new at VB in excel, and would love any help woth a work assignment.

    I have a data sheet with employee information. Only one column. It prefixes information with codes, but keeps it in the same cell. I want to move data of certain types into their own columns, but the amount of data is variable, so I cannot simply move every Nth cell, etc.

    i.e.

    Employee#1
    200 Firstname Lastname
    204 99999999 (Employee ID)
    G38 00005000 (i.e. Pension Deduction)
    H38 00007580 (i.e. Benefits Deduction)
    X96 00012099 (i.e. Staff Club Deduction)
    Employee#2
    200 Firstname Lastname
    204 99999998
    G38 00000775
    X96 00001000

    So you see some employees may have different codes altogether. But I know that I want all the cells that start with 200 to be offset (-1,1), and all the cells that start with 204 to be offset (-1,2), and so on so that basically I end up with columns of info instead of a one column list.

    I have been reading and studying other peoples' macros, and am just starting to grasp the basic. When I wrote my own to accomplish this, I put this together, which doesn't work. But I don't know enough to know what I don't know.

     
    Sub Macro1()
     
    Dim x As Range
     
     
    Do
    Set x = Columns(1).Find("*200 *")
    If x Is Nothing Then Exit Do
    x.Select
    Selection.Cut
    ActiveCell.Offset(-1, 1).Select
    Selection.PasteSpecial
    Loop
    End Sub
    What I have so far finds what I am looking for, copies it but the paste fails.
    Last edited by mr.alexander; 02-07-2009 at 11:56 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1