Forum Discussion

DrewAtKitchenVision's avatar
DrewAtKitchenVision
Copper Contributor
Oct 15, 2021

Copy-Paste as link but also with cell borders?

Hi!

Attached is a sample file.

 

I have written a macro that copies a subset of cells from the source sheet and pastes it into a new sheet as LINKED, enabling the new sheet to update if the source sheet updates. This is done in VBA, so it's a click of a button for the users. That's great...

BUT...

 

I print the resulting sheet for use on the shop floor and they need the underline from the cells on the source to be printed.

 

So, please let me know how to copy and paste both AS LINKED and with CELL BORDERS? The commented-out line using xlPasteFormats does not work. 

 

Here is the section of code I have (and it is working as expected):

'

                ' Perform the copy and paste from Sheet(1) to Sheet("16mmHPL CSV")
                Sheets(1).Range(SourceRange).Copy
                    Sheets("16mmHPL").Select
                    Range(DestinationRange).Select
                    ActiveSheet.Paste Link:=True
                    'ActiveSheet.Paste Format:=xlPasteFormats
                Sheets(1).Select

 

2 Replies

  • NikolinoDE's avatar
    NikolinoDE
    Platinum Contributor

    DrewAtKitchenVision 

    Untested, but should work :))

     

    Insert_formatlink ()
    Sheets ("Sheet1"). Range ("Area2"). EntireRow.Copy
    Sheets ("Sheet1"). Range ("Area2"). EntireRow.Insert Shift: = xlDown, CopyOrigin: = _
    xlFormatFromLeftOrAbove
    Sheets ("Sheet1"). Range ("Area2"). Offset (-1) .EntireRow.ClearContents
    End Sub 

     

     

    I would be happy to know if I could help.

     

    NikolinoDE

    I know I don't know anything (Socrates)

     

    Was the answer useful? Mark them as helpful!

    This will help all forum participants.

    • DrewAtKitchenVision's avatar
      DrewAtKitchenVision
      Copper Contributor

      NikolinoDE  - Thanks for your input, but that's not working for me. I need to paste as a link and with source cell formatting (underline or no underline).

       

      Note that in my sample file that on the PASTE_LINKED sheet there are only 10 columns. They are sheet SOURCE_PAGE columns U through AD. These are the only columns I need to copy over.

       

      Again, thanks fort the effort though!

Resources