7abib0
03-18-2022, 07:30 AM
I need help with VBA code, I have the below code using it to so when I copy+paste through the keyboard shortcut it's Match Destination Formatting.
The issue is when my computer language is in ARB language the copied text is pasted as Keep Source Formatting which cause white cells.
29520
Is there a code I can insert it to force excel to switch the language to ENG so if I paste it will be pasted with Match Destination Formatting?
Sub PasteValues()
' Keyboard Shortcut: Ctrl+Shift+V
' 2005/12/18 Sun
' 2009-10-30 FR Check Application.CutCopyMode
On Error GoTo ErrorHandler
' 2011-05-05 TH Check, if Clipboard is empty
If Application.ClipboardFormats(1) <> -1 Then
If Application.CutCopyMode Then
'Paste values, if in CutCopyMode
Selection.PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
Else
'Paste text, if from external source
ActiveSheet.PasteSpecial Format:="Text"
End If
End If
GoTo FinishMacro
ErrorHandler:
'Error will be caught, if there is nothing to paste
Resume Next
FinishMacro:
Selection.PasteSpecial Paste:=xlPasteValues
End Sub
The issue is when my computer language is in ARB language the copied text is pasted as Keep Source Formatting which cause white cells.
29520
Is there a code I can insert it to force excel to switch the language to ENG so if I paste it will be pasted with Match Destination Formatting?
Sub PasteValues()
' Keyboard Shortcut: Ctrl+Shift+V
' 2005/12/18 Sun
' 2009-10-30 FR Check Application.CutCopyMode
On Error GoTo ErrorHandler
' 2011-05-05 TH Check, if Clipboard is empty
If Application.ClipboardFormats(1) <> -1 Then
If Application.CutCopyMode Then
'Paste values, if in CutCopyMode
Selection.PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
Else
'Paste text, if from external source
ActiveSheet.PasteSpecial Format:="Text"
End If
End If
GoTo FinishMacro
ErrorHandler:
'Error will be caught, if there is nothing to paste
Resume Next
FinishMacro:
Selection.PasteSpecial Paste:=xlPasteValues
End Sub