+ Reply to Thread
Results 1 to 9 of 9

Move cell values from sheet1 to sheet2

  1. #1
    Registered User
    Join Date
    02-25-2013
    Location
    Sverige
    MS-Off Ver
    Excel 2010
    Posts
    5

    Move cell values from sheet1 to sheet2

    What I want to do is as follows: In shett 1 I have imformations in cells A5, B5, C5, B8, C8, E8 and so on
    Now I want to move that information to row 4 - cell a1, b1, c1, d1 and so on, in sheet 2 when a push a button. The information in the cells on sheet 1 will be blanked.
    Next time I move information I want it to go to Row 5 in sheet 2 (the same cells) and so on.
    Is there a way to accomplish this?
    I don't have much experience in Excel

  2. #2
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: Move cell values from sheet1 to sheet2

    Check this macro code:

    movecellvalues.xlsm
    Click *, if my suggestion helps you. Have a good day!!

  3. #3
    Registered User
    Join Date
    02-25-2013
    Location
    Sverige
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Move cell values from sheet1 to sheet2

    The undelying idea works. But what I want is to get information from different cells in different rows.
    Can this work?
    Sheets("sheet1").Rows("5"). Cells("3").Copy (Sheets("sheet2").Range("A" & rcnt)
    Sheets("sheet1").Rows("5"). Cells("6").Copy (Sheets("sheet2").Range("A" & rcnt)
    Sheets("sheet1").Rows("5"). Cells("7").Copy (Sheets("sheet2").Range("A" & rcnt)
    Sheets("sheet1").Rows("7"). Cells("3").Copy (Sheets("sheet2").Range("A" & rcnt)
    Sheets("sheet1").Rows("7"). Cells("5").Copy (Sheets("sheet2").Range("A" & rcnt)
    I don't have Excel available just now for testing

  4. #4
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: Move cell values from sheet1 to sheet2

    If that's the case then why don't you post a sample data file?

  5. #5
    Registered User
    Join Date
    02-25-2013
    Location
    Sverige
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Move cell values from sheet1 to sheet2

    I have here a file to show what I want.

    On Sheet1 in the yellow cells is the information I want to transfere to Sheet2 under corresponding headlines.
    And it is only the yellow fields that shall be blanked.

    Thanks for the help
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: Move cell values from sheet1 to sheet2

    Just one more query:

    Will the yellow fields be always in those rows as in your sample file? I mean to ask if yellow fields will be in rows 12,15,18, 21 fixed?

  7. #7
    Registered User
    Join Date
    02-25-2013
    Location
    Sverige
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Move cell values from sheet1 to sheet2

    Yes, the yellow fields (and all other fields on that sheet) will always be on the same place

  8. #8
    Registered User
    Join Date
    02-25-2013
    Location
    Sverige
    MS-Off Ver
    Excel 2010
    Posts
    5

    Thumbs up Re: Move cell values from sheet1 to sheet2

    I've made it with your help.
    This is my code now:
    Private Sub CommandButton1_Click()
    Dim rcnt As Long
    rcnt = 4
    While Sheets("sheet2").Range("B" & rcnt) <> ""
    rcnt = rcnt + 1
    Wend

    Sheets("sheet1").Range("B12:E12").Copy (Sheets("sheet2").Range("B" & rcnt))
    Sheets("sheet1").Range("B15:E15").Copy (Sheets("sheet2").Range("F" & rcnt))
    Sheets("sheet1").Range("C18:E18").Copy (Sheets("sheet2").Range("J" & rcnt))
    Sheets("sheet1").Range("B21:C21").Copy (Sheets("sheet2").Range("M" & rcnt))
    Sheets("sheet1").Range("E21:E21").Copy (Sheets("sheet2").Range("O" & rcnt))
    Sheets("sheet1").Range("C23:C23").Copy (Sheets("sheet2").Range("P" & rcnt))
    Sheets("sheet1").Range("C25:C25").Copy (Sheets("sheet2").Range("Q" & rcnt))
    Sheets("sheet1").Range("C27:C27").Copy (Sheets("sheet2").Range("R" & rcnt))


    End Sub

  9. #9
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Move cell values from sheet1 to sheet2

    Aderk,
    Please wrap you code with code tags.

+ 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