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.
Bookmarks