+ Reply to Thread
Results 1 to 9 of 9

Code not pasting work in right cell

  1. #1
    Registered User
    Join Date
    07-05-2012
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    51

    Code not pasting work in right cell

    So I have this code below that seperately works perfectly fine together however theres a slight problem that I need help fixing.

    Code Below:


    Please Login or Register  to view this content.
    The problem is this part of the code instead of the code

    Please Login or Register  to view this content.
    Instead of the code pasting the data directly under the old data in the next empty cell for some reason it is pasting the data in row 19 missing a whole load of empty cells. I can't really see whats wrong with the code, because in its own macro it works perfect. so please have a look guys

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,974

    Re: Code not pasting work in right cell

    Usedrange is unreliable. I suggest you use:
    Please Login or Register  to view this content.
    instead of
    Please Login or Register  to view this content.
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Registered User
    Join Date
    07-05-2012
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    51

    Re: Code not pasting work in right cell

    cheers romperstomper i'm relatively new to vba so is there any chance you can show me what needs changing in that code. it would be really appreciate thanks again for the reply

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,974

    Re: Code not pasting work in right cell

    I thought I just did?

  5. #5
    Registered User
    Join Date
    07-05-2012
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    51

    Re: Code not pasting work in right cell

    even though romperstomper seems to have solved the problem, i'm so new to vba that i still haven't gotta clue whats going on. so i'm gonna post again

    this code below is selecting to much data in the data load sheet it should only be selecting cells that are in a2:d that have data in them. then it should copy them and paste them in the rawdata sheet. currently its copying to much so when I paste data a second time the data is not in the next empty cell

    Please Login or Register  to view this content.

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,974

    Re: Code not pasting work in right cell

    Replace:
    Please Login or Register  to view this content.
    with
    Please Login or Register  to view this content.
    is what I was saying. Usedrange is unreliable for working out where the next blank cell is.

  7. #7
    Registered User
    Join Date
    07-05-2012
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    51

    Re: Code not pasting work in right cell

    cheers romperstomper I was just being an idiot for a second.

    It does work really well so i have no problems but out of interest why is the code still copying more cells than the data is actually in, its still copying a load of blank cells.

  8. #8
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,974

    Re: Code not pasting work in right cell

    Same reason - you are using Usedrange to work out how many rows to copy. If you use similar code to calculate Endof1 the problem should be removed.

  9. #9
    Registered User
    Join Date
    07-05-2012
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    51

    Re: Code not pasting work in right cell

    thanks alot romper stomper you've been great help thanks

+ 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