Results 1 to 7 of 7

vba copy paste only half working

Threaded View

  1. #1
    Registered User
    Join Date
    10-04-2012
    Location
    Scotland
    MS-Off Ver
    Excel 2010
    Posts
    4

    vba copy paste only half working

    I'm running the following script on a button push:

    Sub CopyPasteValue()
        Sheets("Sheet1").Range("B41:D73").Copy
        Sheets("Sheet2").Range("B1").PasteSpecial _
        Paste:=xlPasteValues
        Sheets("Sheet2").Columns("D").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
        
        Sheets("Sheet1").Range("J30:L56").Copy
        Sheets("Sheet3").Range("B1").PasteSpecial _
        Paste:=xlPasteValues
        Sheets("Sheet3").Columns("D").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
    End Sub
    B and J are columns with descriptors, D is user entered data as a numerical value and L is formulas providing. The formulas all have a =IF(cell<>0,formula , "") so they are blank until information is input elsewhere.

    The first part works perfectly B41:D73 are copied to sheet2 and any blank cells in column D result in the entire row being deleted so only cells with a value and their accompanying descpritors are left.

    The second part doesn't want to play ball. It copies over J30:L56 to sheet3 but for some reason it doesn't carry out the final part and delete the rows with a blank in column D (or it does and doesn't recognise them as blank.) I'm assuming it's something to do with the source being formulas but I thought the paste special values would mean this isn't an issue.

    Moderator's Edit: Use code tags when you post code in your post. To do so either select your code and click on the # symbol above or type [code] before your code and [/code] after it.
    Last edited by Mummraah; 10-31-2012 at 06:24 AM.

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