+ Reply to Thread
Results 1 to 4 of 4

VBA Copy Paste Problem

  1. #1
    Registered User
    Join Date
    11-18-2010
    Location
    Argentina
    MS-Off Ver
    Excel 2007
    Posts
    2

    VBA Copy Paste Problem

    Hi Guys,


    I have this code,

    Please Login or Register  to view this content.
    There is a formula in each of the "A4:A23" cells;
    Please Login or Register  to view this content.
    , but, when there is no value into Acc, the cell is left blank. And, as I'm doing "PasteSpecial Paste:=xlPasteValues" I can't figure this out. Why is my code pasting the blank cells? As the range (A4:X23) isn't always full, I ONLY want to copy those non-blank cells.
    When I delete the formula from A4:A23 then, it does what I want, It does not copy the blanks.

    So, I don't know... visually speaking, it's blank but, there is a formula assigned to the cell thus, it does not do what I want it to do.

    I hope you guys can figure this out. if you need more details, just let me know.

    Thanks in advance

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: VBA Copy Paste Problem

    Not entirely sure if this will work but try changing "PasteSpecial Paste:=xlPasteValues" to PasteSpecial Paste:=xlPasteAll"

  3. #3
    Registered User
    Join Date
    11-18-2010
    Location
    Argentina
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: VBA Copy Paste Problem

    Quote Originally Posted by stnkynts View Post
    Not entirely sure if this will work but try changing "PasteSpecial Paste:=xlPasteValues" to PasteSpecial Paste:=xlPasteAll"
    Thanks for you replay. If I do as you suggested, i'm sure this code will copy and paste the formulas as well. I in fact need this code -somehow- to NOT to copy the formulas, just the values.

    It should work as it is but, it does not :/

    Thanks stnkynts, your help is appreciated.

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: VBA Copy Paste Problem

    Hmm. Since you want the values and not formulas I would have thought xlPasteValues should have worked. Another way might be to try to set one range = to the other like this:
    Please Login or Register  to view this content.

    Let me know.

+ 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