Pasted cell is blank but not empty

surfengine

New Member
Joined
Jan 29, 2021
Messages
5
Office Version
  1. 2019
Platform
  1. Windows
Not sure how to handle this issue in VB.
I copy all data from a sheet and paste it to a new sheet where the data will be manipulated. One of the cells has a formula that puts a blank, ex: =if(a1=1,1,"")
When that row is copied over it is blank but excel still sees that something is there and my next step which is to remove all rows that have a blank cell in that column doesn't remove any rows.

I know this is an old issue and there are many posts about it everywhere, but none of the solutions I have seen so far help resolve my exact case.

This is my copy/paste code:

VBA Code:
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Rows("1:1").Select
    Application.CutCopyMode = False
    Selection.Delete Shift:=xlUp
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Hi & welcome to MrExcel.
Can you please post all the code, that small portion tells us nothing.
 
Upvote 0
Sure. Hope this is more helpful.

VBA Code:
    Sheets("models").Select
    Cells.Select
    Selection.Copy
    Sheets("temp1").Select
    Cells.Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Rows("1:1").Select
    Application.CutCopyMode = False
    Selection.Delete Shift:=xlUp

The code to delete the rows is this:
Code:
    Columns("k:k").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
It works but only after I manually go in and and make each cell actually empty (by putting cursor in the text bar and pressing enter).
 
Upvote 0
Maybe try replacing the Copy/paste with the code below
VBA Code:
   With Sheets("models").UsedRange
        Sheets("temp1").Cells(1, 1).Resize(.Rows.Count, .Columns.Count).Value = .Value
    End With
 
Upvote 0
Solution

Forum statistics

Threads
1,213,565
Messages
6,114,338
Members
448,570
Latest member
rik81h

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top