+ Reply to Thread
Results 1 to 5 of 5

Compare 2 cells if equal then copy...

Hybrid View

  1. #1
    Registered User
    Join Date
    05-08-2012
    Location
    Budapest
    MS-Off Ver
    2010
    Posts
    33

    Compare 2 cells if equal then copy...

    Hello,

    i would like to compare two cells in a sheet, and if it's equal then copy other cells into a new row. But i am new in excel programming, and i cant do that. Can you help me?

    Forexample
    i have data in A4 and A5 and A6 ...etc
    if i write in b4 the same as a4, then copy a8...a12 into b8...b12

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Compare 2 cells if equal then copy...

    What if b5=a5, which rows should be copied?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    05-08-2012
    Location
    Budapest
    MS-Off Ver
    2010
    Posts
    33

    Re: Compare 2 cells if equal then copy...

    left out: i need a macro for it

  4. #4
    Forum Expert
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    1,312

    Re: Compare 2 cells if equal then copy...

    Hi
    this code will make what you described but You should give us more details (any sample?)
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address(0, 0) = "B4" Then
    If Target = Target.Offset(0, -1) Then
    Range("a8:a12").Copy Destination:=Range("b8:b12")
    End If
    End If
    End Sub
    Regards

    tom1977

    If You are satisfied with my solution click the small star icon on the left to say thanks.

  5. #5
    Registered User
    Join Date
    05-08-2012
    Location
    Budapest
    MS-Off Ver
    2010
    Posts
    33

    Re: Compare 2 cells if equal then copy...

    it's working, but it's paste the range, when i delete b4
    (sorry if i made mistakes but i am not so good in english)

+ 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