I have these 3 pieces of code, which work differently but deliver similar result. The aim is that I have in a separate column only the values from filled cells, and no blanks
This code copies only the results from the formulas in
I10:I61
. The formula returns also "", which I do not need.With Worksheets("Calculator").Range("I10:I61") .Offset(, 0).SpecialCells(xlCellTypeFormulas, xlNumbers).Copy Worksheets("Graphs").Range("F2").PasteSpecial SkipBlanks:=True, Paste:=xlPasteValues End With
This code copies values, where there are no formulas
With Worksheets("Calculator") Set VisRng = .Range("D10:D61").SpecialCells(xlCellTypeConstants) VisRng.Copy Worksheets("Graphs").Range("B2").PasteSpecial xlValues End With
This is supposed to copy text results from formula. It does not work. The formula returns also "", which I do not need.
With Worksheets("Calculator").Range("K10:K61") .Offset(, 0).SpecialCells(xlCellTypeFormulas, xlTextValues).Copy Worksheets("Graphs").Range("A2").PasteSpecial SkipBlanks:=True, Paste:=xlPasteValues End With
However, the last piece of code does not work. It should copy and paste only the filled cells and not the emty once(containing ""). Now it copies and pastes everything. How can I make it work? The result is:
K A
Paris Paris
Amsterdam Amsterdam
I need it to be
A
Paris
Amsterdam