+ Reply to Thread
Results 1 to 2 of 2

Simple copy/paste link query

Hybrid View

  1. #1
    Registered User
    Join Date
    05-19-2008
    Posts
    56

    Simple copy/paste link query

    When I copy column A and do a 'Paste Link' into column B, any blank cells in column A are converted to a '0' in column B. I've tried everything to prevent this from happening, with no joy.

    Any ideas?

  2. #2
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    unfortunately, as far as i know you cannot bypass that because you are linking to an empty cell that excel believes is a number and so shows a zero, however help is at hand, you can place this code on a standard module (Alt+F11, then right click on the left ahnd side and choose Insert, Module) then when you run the code from within the VBE or from a button or shortcut it should enter the correct formula to eliminate the 0's
    Sub Eliminate_0()
    Dim Rng As Range, MyCell As Range
       Set Rng = Range("A1:A15")
       Rng.Copy
        Range("B1").Select
        ActiveSheet.Paste Link:=True
        Application.CutCopyMode = False
        For Each MyCell In Rng
        If MyCell.Value = "" Then
        MyCell.Offset(0, 1).Value = "=If(" & MyCell.Address & "=" & Chr(34) & Chr(34) _
         & "," & Chr(34) & Chr(34) & "," & MyCell.Address & ")"
        End If
        Next
    End Sub
    Not all forums are the same - seek and you shall find

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1