如何保持每个单元格中合并单元格的价值? [英] How to keep value of merged cells in each cell?

查看:101
本文介绍了如何保持每个单元格中合并单元格的价值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用合并的单元格创建了一个工作表,但是合并后的单元格的值仅存储在第一个单元格中.无论如何,要在每个单元格中保持相同的值,我需要一个用于我使用的公式的值.谢谢!

I created a sheet with merged cells, but the value of the merged cells is only stored in the first cell. Is there anyway, to keep the same value in each of the cells, I need that for a formula I use. Thanks!

推荐答案

在Excel 2003中,此宏可以完成这项工作:

In Excel 2003 this macro does the job:

Public Sub UnmergeAndFill()
    With Selection
        If .MergeCells Then
            .MergeCells = False
            Selection.Cells(1, 1).Copy
            ActiveSheet.Paste 'Or PasteSpecial xlPasteFormulasAndNumberFormats
        End If
    End With
End Sub

通过

  1. 按下 Alt-F11 Ctrl-R ,菜单Insert/Module,粘贴代码;
  2. 或者: Alt-F8 ,输入新名称(例如UnmergeAndFill),单击MakeCreate(?不知道英文按钮文字)
  1. pressing Alt-F11, Ctrl-R, menu Insert/Module, paste the code;
  2. alternatively: Alt-F8, type a new name (UnmergeAndFill, e.g.), click Make or Create (? don't know the English button text)

按Alt-F8调用宏,将其选中,Run.或者将其映射到键

Invoke the Macro by pressing Alt-F8, select it, Run. Alternatively map it to a key

这篇关于如何保持每个单元格中合并单元格的价值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆