-
Notifications
You must be signed in to change notification settings - Fork 0
/
Colar Somente Valores.vbs
42 lines (28 loc) · 1023 Bytes
/
Colar Somente Valores.vbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
'Essa função faz com seja possivel somente colar em valores
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim UndoList As String
Application.ScreenUpdating = False
Application.EnableEvents = False
On Error GoTo Whoa
UndoList = Application.CommandBars("Standard").Controls("&Desfazer").List(1)
If Left(UndoList, 5) <> "Colar" And UndoList <> "Preenchimento Automático" _
Then GoTo LetsContinue
Application.Undo
If UndoList = "Preenchimento Automático" Then Selection.Copy
On Error Resume Next
Target.Select
ActiveSheet.PasteSpecial Format:="Texto", _
Link:=False, DisplayAsIcon:=False
Target.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
On Error GoTo 0
Union(Target, Selection).Select
LetsContinue:
Application.ScreenUpdating = True
Application.EnableEvents = True
Exit Sub
Whoa:
MsgBox Err.Description
Resume LetsContinue
End Sub