Office中Excel如何实现选择单元格,所属列和行会自动变成黄色(可自定义)---文章中附带效果图

   本文讲的是,针对一些没有wps或者不能使用wps的小盆友们,如何去实现选中单元格后,该单元格所在行和列自动填充效果,当然wps一键就可以实现该功能,如图

这里着重介绍如何用office来实现。

1.首先,Ctrl+A 全选当前页面的内容,在开始页中,选中条件格式,新建规则。

2.选择第四个,图中是英文版的,中文版对应的内容应该是“使用公式确定要设置格式的单元格”,然后在Format values where this formula is true (为符合此公式的值设置格式),中将

=(CELL("row")=ROW())+(CELL("col")=COLUMN())

粘贴进去,然后点击右下角的Format(格式)。

3.然后选择Fill(填充),选择自定义的颜色,点击ok(注意外层也有个ok,都要点)。

 

此时返回去,我们看见仅有一个单元格起作用,暂时还不是动态的效果。

4.接下来按住Alt+F11,打开VBE界面,选中当前sheet页,双击会弹出白色框,再框中输入如下代码

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Calculate
Application.ScreenUpdating = False
Application.ScreenUpdating = True
End Sub

5.点击保存,选择Yes->ok ,回到excel中即可看到效果

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
在vue3-antDesign4x实现表单单元格合并并自定义内容可以通过以下步骤实现: 1. 使用 Table 组件渲染表格数据,并设置合并单元格的条件和方式 2. 在表格定义自定义单元格模板,用于渲染合并后的单元格内容 3. 在表格使用 scoped slot 的方式,将自定义单元格模板作为 slot 传入,实现单元格内容的自定义 以下是示例代码: ```html <template> <a-table :columns="columns" :dataSource="dataSource" :rowKey="record.id"> <template v-for="(item, index) in mergeCells"> <template v-if="index === 0"> <template v-for="(col, colIndex) in item.cols"> <template v-if="col.span !== 0"> <template v-if="colIndex === item.cols.length - 1"> <a-table-column :title="item.title" :key="item.key" :align="item.align" :width="item.width"> <template #customCell="scope"> <div v-html="item.content"></div> </template> </a-table-column> </template> </template> </template> </template> <template v-else> <template v-for="(col, colIndex) in item.cols"> <template v-if="col.span !== 0"> <template v-if="colIndex === item.cols.length - 1"> <a-table-column :title="item.title" :key="item.key" :align="item.align" :width="item.width"> <template #customCell="scope"> <div v-html="item.content"></div> </template> </a-table-column> </template> </template> </template> </template> </template> </a-table> </template> <script> export default { data() { return { dataSource: [], columns: [], mergeCells: [ { title: '合并单元格标题', key: 'mergeCell', align: 'center', width: 200, cols: [ { key: 'col1', span: 1 }, { key: 'col2', span: 2 } ], content: '<span>自定义合并单元格内容</span>' } ] } }, mounted() { // 初始化表格数据和配置 this.dataSource = [ { id: 1, col1: '数据1', col2: '数据2', col3: '数据3' }, { id: 2, col1: '数据1', col2: '数据2', col3: '数据3' } ] this.columns = [ { title: '1', dataIndex: 'col1', key: 'col1' }, { title: '2', dataIndex: 'col2', key: 'col2' }, { title: '3', dataIndex: 'col3', key: 'col3' } ] } } </script> ``` 在上述示例代码,我们通过定义一个 `mergeCells` 数组来描述需要合并的单元格,包括合并单元格的标题、对应的配置、合并的方式和自定义单元格内容。然后在表格使用 `v-for` 循环遍历 `mergeCells` 数组,根据合并单元格配置设置对应的 `span` 属性,实现单元格的合并。同时,为了实现单元格自定义内容,我们在表格定义一个名为 `customCell` 的 slot,并将自定义单元格模板作为 slot 内容传入,这样就可以在表格渲染出自定义单元格内容。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

阿土不土

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值