跳到主要内容

如何在Excel中限制仅粘贴值(防止格式设置)?

通常,我们只需同时按下Ctrl + V键就可以粘贴复制的数据。 然后,将粘贴复制的值以及所有单元格格式。 如果只需要粘贴值并限制单元格格式,则以下方法可以为您提供帮助。

使用粘贴值功能仅限制粘贴值(防止格式化)
限制仅粘贴带有VBA代码的值(防止格式化)
限制仅使用 Kutools for Excel 粘贴值


使用粘贴值功能仅限制粘贴值(防止格式化)

限制仅粘贴值的一种简单方法是将复制的数据粘贴为仅在Excel中的值。

1.复制数据后,右键单击要将数据粘贴到的目标单元格。

2.然后点击 价值观 按钮下 粘贴选项 单击鼠标右键。 看截图:

您只能看到复制的单元格的值粘贴到目标单元格中​​。


限制仅粘贴带有VBA代码的值(防止格式化)

以下VBA代码可帮助您仅粘贴复制的单元格的值,并限制所有单元格的格式。 请执行以下操作。

1。 按 其他 + F11 同时打开 Microsoft Visual Basic应用程序 窗口。

2.在 Microsoft Visual Basic应用程序 窗口,双击 的ThisWorkbook ,在 项目 右窗格打开 的ThisWorkbook 代码窗口。 然后将下面的VBA代码复制并粘贴到窗口中。

VBA代码:仅限于在Excel中粘贴值

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
    On Error Resume Next
    Target.PasteSpecial xlPasteValues
    Application.CutCopyMode = True
End Sub

3。 按 其他 + Q 同时按下键以关闭“ Microsoft Visual Basic for Applications”窗口。

现在,复制您的数据,然后转到目标工作表。 在目标单元格上单击或右键单击都将粘贴复制的单元格的值,而不会立即进行任何格式化。


限制仅使用 Kutools for Excel 粘贴值

Excel 的 Kutools's 复制范围 实用程序可帮助您轻松地在Excel中仅粘贴选定范围或多个选定范围的值。 请执行以下操作。

申请前 Kutools for Excel首先下载并安装.

1.按住,选择一个或多个范围 按Ctrl 键,然后单击 库工具 > 复制范围

2.在 复制多个范围 对话框中,仅选择 价值观 在选项 特殊粘贴 部分,然后单击 OK 按钮。

备注:您可以选择两个或两个 包括行高包括列宽 您需要的选项。

3.在下 复制多个范围 对话框,选择一个空白单元格以粘贴复制的单元格,然后单击 OK 按钮。

然后,仅粘贴一个或多个范围内所有选定单元格的值。

  如果您想免费试用(30天)此实用程序, 请点击下载,然后按照上述步骤进行操作。


相关文章:

最佳办公生产力工具

🤖 Kutools 人工智能助手:基于以下内容彻底改变数据分析: 智能执行   |  生成代码  |  创建自定义公式  |  分析数据并生成图表  |  调用 Kutools 函数...
热门特色: 查找、突出显示或识别重复项   |  删除空白行   |  合并列或单元格而不丢失数据   |   不使用公式进行四舍五入 ...
超级查询: 多条件VLookup    多值VLookup  |   跨多个工作表的 VLookup   |   模糊查询 ....
高级下拉列表: 快速创建下拉列表   |  依赖下拉列表   |  多选下拉列表 ....
列管理器: 添加特定数量的列  |  移动列  |  切换隐藏列的可见性状态  |  比较范围和列 ...
特色功能: 网格焦点   |  设计图   |   大方程式酒吧    工作簿和工作表管理器   |  资源库 (自动文本)   |  日期选择器   |  合并工作表   |  加密/解密单元格    按列表发送电子邮件   |  超级筛选   |   特殊过滤器 (过滤粗体/斜体/删除线...)...
前 15 个工具集12 文本 工具 (添加文本, 删除字符,...)   |   50+ 图表 类型 (甘特图,...)   |   40+ 实用 公式 (根据生日计算年龄,...)   |   19 插入 工具 (插入二维码, 从路径插入图片,...)   |   12 转化 工具 (小写金额转大写, 货币兑换,...)   |   7 合并与拆分 工具 (高级组合行, 分裂细胞,...)   |   ... 和更多

使用 Kutools for Excel 增强您的 Excel 技能,体验前所未有的效率。 Kutools for Excel 提供了 300 多种高级功能来提高生产力并节省时间。  单击此处获取您最需要的功能...

产品描述


Office Tab 为 Office 带来选项卡式界面,让您的工作更加轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,发布者,Access,Visio和Project。
  • 在同一窗口的新选项卡中而不是在新窗口中打开并创建多个文档。
  • 每天将您的工作效率提高50%,并减少数百次鼠标单击!
Comments (14)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hello, there are a problem here, values are automatically paste when you click on the cell
This comment was minimized by the moderator on the site
Hi, any chance to add this feature only in some sheets?
This comment was minimized by the moderator on the site
Hallo,
ich habe eine Excel-Datei (100 Tabellenregister) für die ich eine Formel gesucht habe, die es erlaubt, beim Kopieren nur Werte einfügen, möglich zu machen.

Ausschneiden+Drag&Drop habe ich bereits per Makro ausgeschaltet. Ich habe jetzt im Netz folgenden Code gefunden, den ich in
"Diese Arbeitsmappe" geschrieben habe:

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
On Error Resume Next
Target.PasteSpecial xlPasteValues
Application.CutCopyMode = True
End Sub

(Der Code verursacht, dass ich nach kopieren, den Inhalt sofort als Wert in eine angeklickte Zelle kopiert bekomme)
Das funktioniert sehr gut, jedoch habe ich noch ein Problem dabei:

Wenn ich Werte aus einer Zelle kopiere, kann ich diese auch in geschützte
Zellen kopieren und das soll nicht sein. In vielen geschützten Zellen stehen Formeln die nicht überschrieben werden sollen.

Kann mir jemand helfen, wie ich den Code erweitern oder ändern kann, dass er es nur erlaubt in nicht geschützte Zellen zu kopieren?

Gruß Heiko
This comment was minimized by the moderator on the site
Hi! for Kutools 'Copy Ranges', I realized there is limit on number of columns that can be copy at a time. I am working with 7,500 columns. I select 7,500 columns as the range, but it can only copy and paste partial of what I had selected, not all. I am planning to copy all these columns in one go and paste. Is there any way I can do that ? just to speed things up. Any help would highly be appreciated. Thanks!
This comment was minimized by the moderator on the site
Hi, is there code for working with ctrl+v. This code paste automatically when selecting cell. I found module code below link but couldn't find code for workbook like this.
https://www.extendoffice.com/documents/excel/2545-excel-set-paste-values-as-default.html
This comment was minimized by the moderator on the site
It's sad no one answers. I need this information too.
This comment was minimized by the moderator on the site
This code was great, but it was pasting items in the system clipboard that were copied from other programs. I put it in an 'If' statement which does nothing, unless Excel cells are actually in Cut or Copy mode. i.e. moving border around the cell(s).

Application.CutCopyMode has three modes: False = Not in Cut or Copy mode. | xlCopy = In Copy mode. | xlCut = In Cut mode.

'If in Cut or Copy mode, Paste Values Only
'If Not in Cut or Copy mode, skip and do nothing.

On Error Resume Next
If Not Application.CutCopyMode = False Then
Target.PasteSpecial xlPasteValues
Application.CutCopyMode = True
End If

This was a bit of a bugger for me to figure out. Hope it helps someone else.
-Travis (IT Professional since 1996)
This comment was minimized by the moderator on the site
This addition was a great help! Thank you so much for posting!
This comment was minimized by the moderator on the site
Hi Travis, Thank you very much for posting this.
I never respond to posts but i appreciate you posting this answer.
This comment was minimized by the moderator on the site
Hi Travis, is there code for working with ctrl+v. This code paste automatically when selecting cell. I found module code below link but couldn't find code for workbook like this. I hope what I have requested is possible.
https://www.extendoffice.com/documents/excel/2545-excel-set-paste-values-as-default.html
This comment was minimized by the moderator on the site
Dean, it is very useful! Thanks!
This comment was minimized by the moderator on the site
Thank you so much!! It works well and its so useful for the project that I am working on.
This comment was minimized by the moderator on the site
This works for me:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error Resume Next
Target.PasteSpecial xlPasteValues
Application.CutCopyMode = True
End Sub
This comment was minimized by the moderator on the site
Would this work on Worksheet level only? I am trying to restrict this only on one worksheet (not entire workbook), but it seems there is a problem.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations