Excel protecting formatting

  • Thread starter Thread starter Rob
  • Start date Start date
R

Rob

Hi All

How can I prevent cell formats from being removed or
being overwritten when data is cut or pasted from another
cell.

I do not wish to rely on users having to use the "Paste
Special" option.

Many thanks
 
Maybe you could just intercept the change. This worked in light testing.

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

Dim myFormulas As Variant

On Error GoTo errHandler:

myFormulas = Target.Formula
With Application
.EnableEvents = False
.Undo
End With
Target.Formula = myFormulas

errHandler:
Application.EnableEvents = True

End Sub

rightclick on the worksheet tab that should have this behavior. Select View
code and paste this in.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top