+ Reply to Thread
Results 1 to 10 of 10

Loop to find a cell, then copy offset paste

Hybrid View

  1. #1
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Loop to find a cell, then copy offset paste

    Your post does not comply with Rule 9 of our Forum RULES. If you solve a problem yourself before anyone else has responded, please take a moment to describe your solution, chances are some other member will benefit. And please never edit a thread in which someone else has responded.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  2. #2
    Registered User
    Join Date
    01-29-2013
    Location
    Poland
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Loop to find a cell, then copy offset paste

    hello, i need macro to find value in column A(level) (in next column are values too), after find this value, cut all data from this row and move right to defined offset.

    eg line with level:

    0 not move
    1 not move
    2 move right one position all data with this line
    3 move right two position all data with this line
    4 move right three position all data with this line
    5 move right four position all data with this line




    I have to make tree structure

    my macro is:

    Sub Macro1()
     
    Dim x As Range
     
     
    Do
    Set x = Columns(1).Find("2*")
    If x Is Nothing Then Exit Do
    x.Select
    Selection.Cut
    ActiveCell.Offset(0, 1).Select
    ActiveSheet.Paste
    Loop
    
    Do
    Set x = Columns(1).Find("3*")
    If x Is Nothing Then Exit Do
    
    Selection.Cut
    ActiveCell.Offset(0, 2).Select
    ActiveSheet.Paste
    Loop
    
    Do
    Set x = Columns(1).Find("4*")
    If x Is Nothing Then Exit Do
    x.Select
    Selection.Cut
    ActiveCell.Offset(0, 3).Select
    ActiveSheet.Paste
    Loop
    
    Do
    Set x = Columns(1).Find("5*")
    If x Is Nothing Then Exit Do
    x.Select
    Selection.Cut
    ActiveCell.Offset(0, 4).Select
    ActiveSheet.Paste
    Loop
    
    
    
    End Sub
    but move only one cell right (i need all data from line move right to define position)
    please help
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by arlu1201; 01-29-2013 at 08:46 AM.

+ Reply to Thread

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