Blank cells as result of formula with ""

Joe78man

New Member
Joined
Nov 26, 2018
Messages
15
Hello guys,

I'm making a macro that finds the last empty cell and paste from there, the problem I'm having is that Excel won't consider an empty cell when copying a cell which formula's result is "" and pasting values, hence, the macro leaves as many empty cells as where copied from blank cells (as result of a formula)

It's kinda hard to explain so I will ilustrate:

Cell A1:
=IFERROR(INDEX(Summary!$AA:$AA,MATCH(COUNTA($H$14:H14),Summary!$AK:$AK,0)),"")
let's say there is an error and the cell value is ""

Macro button would copy A1 and paste values at B1 (just to ilustrate)
B1 looks empty, but when I use ctrl+arrows to move it stops there as if it had an actual value. I tried skipping blanks but it seems excel considers "" as a value:oops: and not null, so when pasting it pastes the same 'value' and when moving across the sheet it behaves as if the cell had a content.

Do anybody know a work around?

Thanks
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Do you want to find the last empty cell in a row or in a column?
 
Upvote 0
in the macro you could try to place an if statment

if a1 value equal "" then do nothing

this way the macro wouldn't do anything to column B and you should not have a problem
 
Upvote 0
Hi & welcome to MrExcel.
Could you supply the macro?
 
Upvote 0
Maybe I was not clear. The macro just finds the last empty cell, the macro is not the problem, the problem is that if you have a formula like this

=if(2>1,"true","") <- Mind the "", that is the result I mean

You will see the cell empty as result of the formula, but if you copy that cell and paste the VALUES on another cell, the destination cell is not actually empty. Given my macro finds the last empty cell, it will consider the "" pasted as value as a cell with a value.
 
Upvote 0
Do you want to find the last empty cell in a row or in a column?
I know how to do it, the problem is how excel considers "" as a result of a formula. As far as I can see it is not actually empty, instead it seems to have the value="" and when you use ctrl and the arrow keys to move it will behave as if it had an actual value, meaning that using ctrl+arrows to move won't work to find the last cell with value (either in a column or a row)
 
Upvote 0
Hi & welcome to MrExcel.
Could you supply the macro?

Private Sub Save_Click()
'Boton SAVE
'copia el resultado de todas las evaluaciones en la tab 'Results' debajo de la ultima entrada existente
Worksheets("summary").Range("H14:V36").Copy
Sheets("Results").Activate
Selection.End(xlToLeft).Select
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Selection.End(xlUp).Select
ActiveCell.Offset(1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Transpose:=True
Sheets("Summary").Activate
Application.CutCopyMode = False


End Sub
 
Upvote 0
Add this line
Code:
Selection.PasteSpecial paste:=xlPasteValues, Transpose:=True
[COLOR=#0000ff]Selection.Value = Selection.Value[/COLOR]
Sheets("Summary").Activate
Your cells should now be blank
 
Upvote 0
Add this line
Code:
Selection.PasteSpecial paste:=xlPasteValues, Transpose:=True
[COLOR=#0000ff]Selection.Value = Selection.Value[/COLOR]
Sheets("Summary").Activate
Your cells should now be blank

Just perfect!, thank you so much.

Would you mind explaining to me what that magical line does? I suppose what it does, but I'd like to know the logic behind it to use it in any other context
 
Upvote 0
When you paste as values & a cell has a formula that returns "", the paste command has to paste something,so it inserts a NullString.
But when you do .Value=.Value it removes any NullStrings as they don't have a value.
 
Upvote 0

Forum statistics

Threads
1,215,217
Messages
6,123,673
Members
449,116
Latest member
HypnoFant

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