如何让excel表空白处自动画杠(excel怎么把表格线去掉调成空白)

如何让excel表空白处自动画杠(excel怎么把表格线去掉调成空白)

首页维修大全综合更新时间:2024-05-04 03:18:47

如何让excel表空白处自动画杠

、同时按Alt+F11进入宏界面,点菜单的插入,模块,粘贴如下代码:

Sub Auto()

Dim iAreaCount As Integer

Dim R, C, I As Integer

iAreaCount = Selection.Areas.Count

If iAreaCount

For R = Selection.Row To Selection.Row + Selection.Rows.Count - 1

For C = Selection.Column To Selection.Column + Selection.Columns.Count - 1

If Cells(R, C) = "" Then Cells(R, C).FormulaR1C1 = "-"

Next C

Next R

Else

For I = 1 To iAreaCount

For R = Selection.Areas(I).Row To Selection.Areas(I).Row + Selection.Areas(I).Rows.Count - 1

For C = Selection.Areas(I).Column To Selection.Areas(I).Column + Selection.Areas(I).Columns.Count - 1

If Cells(R, C) = "" Then Cells(R, C).FormulaR1C1 = "-"

Next C

Next R

Next I

End If

End Sub

2、选择你要写入“-”的区域(可以包括非空白的区域,也可以按Ctrl同时选多个区域)

3、运行宏中的Auto就可以了

大家还看了
也许喜欢
更多栏目

© 2021 3dmxku.com,All Rights Reserved.