XL Paste Links Blanks

In XL when we paste links; some blanks come accros as zeros. We want blanks in th esource spreadsheet, to be represented as blanks in the target spreadsheet also.
Orange-County-JoeAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Ingeborg Hawighorst (Microsoft MVP / EE MVE)Connect With a Mentor Microsoft MVP ExcelCommented:
Hello Orange-County-Joe,

linking to a cell that contains a blank will return a zero.

=Sheet2!A1

This will return zero if the cell is empty.

To return a blank, you would need to encase it in a check

=if(isblank(Sheet2!A1),"",Sheet2!A1)

cheers, teylyn
0
 
Dave BrettConnect With a Mentor Vice President - Business EvaluationCommented:
To use Paste Links with Blanks successfully requires some basic code that

  • Copies and paste links the range as per the manual method you tryed
  • Deletes the intended blanks automatically
Please see attached sample code in the file, this can be tailored to accept user input for the source and destination range

Cheers

Dave

Sub PasteLinks()
    Dim rng1 As Range, rng2 As Range
    Set rng1 = Sheets(1).UsedRange
    rng1.Copy
    On Error Resume Next
    Set rng2 = rng1.SpecialCells(xlCellTypeBlanks)
    On Error GoTo 0
    Application.Goto Sheets(2).Range(rng1.Cells(1).Address)
    ActiveSheet.Paste Link:=True
    If Not rng2 Is Nothing Then Sheets(2).Range(rng2.Address) = vbNullString
End Sub

Open in new window

pastelinks.xls
0
 
tilsantConnect With a Mentor Commented:
or else u can try this .........u can go to .......Tools >> Options >> View >> UNTICK the "Zero Values"


tils.
0
All Courses

From novice to tech pro — start learning today.