Pasted cell is blank but not empty

surfengine

New Member
Joined
Jan 29, 2021
Messages
3
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

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
56,406
Office Version
  1. 365
Platform
  1. Windows
Hi & welcome to MrExcel.
Can you please post all the code, that small portion tells us nothing.
 

surfengine

New Member
Joined
Jan 29, 2021
Messages
3
Office Version
  1. 2019
Platform
  1. Windows
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).
 

MARK858

MrExcel MVP
Joined
Nov 12, 2010
Messages
14,034
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
  2. Mobile
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
 
Solution

MARK858

MrExcel MVP
Joined
Nov 12, 2010
Messages
14,034
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
  2. Mobile
You're welcome
 

Watch MrExcel Video

Forum statistics

Threads
1,129,259
Messages
5,635,119
Members
416,842
Latest member
Ateen4ever

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
Top