Results 1 to 5 of 5

Thread: Moving Row (VBA - Excel) (Resolved)

  1. #1

    Thread Starter
    Addicted Member señorbadger's Avatar
    Join Date
    Oct 2003
    Location
    Mud pools of wellingborough
    Posts
    193

    Moving Row (VBA - Excel) (Resolved)

    Hi how could i move a row of data in vba?
    I would like to move it from one sheet to another
    Last edited by señorbadger; Dec 13th, 2003 at 02:19 AM.

  2. #2
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697
    Is this what you're after?

    VB Code:
    1. Private Sub Command1_Click()
    2.     Rows("4:4").Select 'Select row 4
    3.     Selection.Copy ' Copy row 4
    4.     Sheets("Sheet2").Select 'Select new sheet
    5.     Range("A3").Select ' select where to paste on new sheet
    6.     ActiveSheet.Paste ' paste
    7. End Sub

  3. #3

    Thread Starter
    Addicted Member señorbadger's Avatar
    Join Date
    Oct 2003
    Location
    Mud pools of wellingborough
    Posts
    193
    Didnt work mate any ideas the problem is


    runtime error 1004

    select method of range class failed

    the code it moans about is...

    Code:
    Rows("4:4").Select

  4. #4
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697
    I tested the code and it works fine. Are you using the code in VB or VBA?

  5. #5

    Thread Starter
    Addicted Member señorbadger's Avatar
    Join Date
    Oct 2003
    Location
    Mud pools of wellingborough
    Posts
    193
    O it was in VBA Excel BTW
    Thanks all one of the mvp's helped me with this

    VB Code:
    1. Sheet5.Cells(counter1,1).EntireRow.Copy
    2. Destination:=Sheet3.Cells(10,1)

    thanks again Sam Lad

Posting Permissions

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



Click Here to Expand Forum to Full Width