Results 1 to 2 of 2

Thread: Cut operation in Excel macro

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2004
    Posts
    3

    Cut operation in Excel macro

    Hi there!

    I got this Subroutine of an excel macro. And it basically started to delete rows that were present more than one time in a sheet. Though now I don't want to delete them, I want to cut them to a different sheet in my excel file. How can I do this?

    Here's the code I got so far;

    Sub Delete_doubles()
    last = Range("A65000").End(xlUp).Row
    For i = last To 2 Step -1
    If Range("A" & i) = Range("A" & i - 1) Then
    'Range("A" & i).EntireRow.Delete
    Range("A" & i).EntireRow.Cut (Sheet2)
    End If
    Next i
    End Sub

    This line Range("A" & i).EntireRow.Cut (Sheet2) doesn't past the information in Sheet2!

    I hope someone can help me....

    Reez

  2. #2
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950
    From Help (this is copy, just change to cut)
    VB Code:
    1. Sub CopyRow()
    2.     Worksheets("Sheet1").Rows(1).Copy
    3.     Worksheets("Sheet2").Select
    4.     Worksheets("Sheet2").Rows(1).Select
    5.     Worksheets("Sheet2").Paste
    6. End Sub

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