NOT taking cell borders with copy/paste.

Ran Taro

New Member
Joined
Apr 2, 2005
Messages
32
I want to make it so that when a user copies and pastes information from one cell to another, the cell borders don't come along with the information.

I tried using conditional formatting in the target cell to change it back to what I want, but for some reason I cant get the conditional formatter to give me a thick border, which I need in the target cell.

help?!?
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Thank you, that is a good solution, but not the one I'm after.

There are multiple people who will cut and paste in this spreadsheet, and it will be impossible to get them all to paste special instead of just pasting.

If there is a way to make a conditional format use a thick line for a border, or even a macro that does the same when text is pasted into a cell, that would do the trick...
 
Upvote 0
Hi
does this help?
Code:
Sub test()
Dim a, rng1 As Range, rng2 As Range
Set rng1 = Application.InputBox("Select range to copy", Type:=8)
Set rng2 = Application.InputBox("select range to paste", Type:=8)
If rng1 Is Nothing Or rng2 Is Nothing Then Exit Sub
a = rng1.Value
rng2.Item(1).Resize(UBound(a, 1), UBound(a, 2)).Value = a
End Sub
 
Upvote 0
Very clever Jindon. Not quite right but it does help because it gives me an idea.

I might just use a macro based on worksheet activate to reset the formatting of the target cell each time the worksheet is opened.
 
Upvote 0
Hi,

You could also try the following code which ensures ONLY values are pasted:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim varPastedValue As Variant
    With Application
        If .CutCopyMode Then
            .ScreenUpdating = False
            .EnableEvents = False
            varPastedValue = Target.Value
            .Undo
            Target.Value = varPastedValue
            .EnableEvents = True
            .ScreenUpdating = True
        End If
    End With
End Sub


Regards.
 
Upvote 0

Forum statistics

Threads
1,223,249
Messages
6,171,031
Members
452,374
Latest member
keccles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top