tombata
tombata

Reputation: 259

VBA Skip blank does not work

I have this code in excel, which copies a range and pastes it. However it does not skip blanks, how it is supposed to do.

With Worksheets("Calculator")
    .Range("H10:H61").Copy
    Worksheets("Graphs").Range("D2").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
    SkipBlanks:=True, Transpose:=False
End With

The range H10:H61 contains only values, no fromulas.

Upvotes: 2

Views: 4644

Answers (1)

Shai Rado
Shai Rado

Reputation: 33672

Sadly, skip blanks doesn't do what you think it does, you can read here what it does Chandoo

Try the code below instead:

Dim VisRng As Range

With Worksheets("Calculator")
    Set VisRng = .Range("H10:H61").SpecialCells(xlCellTypeConstants)
    VisRng.Copy
    Worksheets("Graphs").Range("D2").PasteSpecial xlValues
End With

Upvotes: 3

Related Questions