+ Reply to Thread
Results 1 to 1 of 1

Copy/paste-button - wrong reference code in sheet 2

Hybrid View

  1. #1
    Registered User
    Join Date
    07-07-2009
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    3

    Copy/paste-button - wrong reference code in sheet 2

    So i have a button that copies data from cell
    A5:K5, and pastes it in Sheet2 of my workbook.

    The data is ordered like this


    ------
    ------
    ------ button1

    ------
    ------
    ------ button2

    ------
    ------
    ------ buttonX

    I have like 40 buttons attached to 4 rows each. And in that group of rows, i have some cells with an IF= formula, and some minor coding.
    The problem is: If i press button 3,4,17,29 before i press every other button before that. I get an reference code fail at the cell.

    If i press the buttons in order. Like 1,2,3,4,5,6,7 - it appears smoothly.

    Does anybody have a clue on how to fix it?



    More info: The button copies data from for example A5:K5 and pastes it into the next blank row of sheet2. But i want to be able to press button 2 before i press button1, without getting an error in my =IF cell.

    If i press the 40 buttons in a row, and then starts to mix up the button pressing. It appears smoothly.



    Please, help me:D Thanks:D

    btw, here is the buttoncode, which i got from a person in here:
    Private Sub CommandButton1_Click()
    Dim x As Long
    x = Sheets("Sheet2").Cells(Rows.Count, 1).End(xlUp).Row
    Sheets("Sheet1").Range("A1:J3").Copy
    Sheets("Sheet2").Range("A" & x + 1).PasteSpecial
    Sheets("sheet2").Range("k" & x + 1).Value = Now()
    End Sub
    Last edited by Krapter; 07-08-2009 at 05:39 AM. Reason: more info

+ 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