Excel精英培训网

 找回密码
 注册
数据透视表40+个常用小技巧,让你一次学会!
查看: 1774|回复: 4

[已解决]过程不能执行

[复制链接]
发表于 2011-12-6 10:49 | 显示全部楼层 |阅读模式
sub test(rng as range)
Dim rng As Range
If rng Is Nothing Then
Cells.ClearFormats
Else
rng.ClearFormats
end if
end sub
这个过程为什么不能执行呢
最佳答案
2011-12-6 10:57
sub test(rng as range)
把这句去掉就行了,还有一个问题

  Cells.ClearFormats
这个是清除所有格式,
excel精英培训的微信平台,每天都会发送excel学习教程和资料。扫一扫明天就可以收到新教程
发表于 2011-12-6 10:51 | 显示全部楼层
回复

使用道具 举报

发表于 2011-12-6 10:57 | 显示全部楼层    本楼为最佳答案   
sub test(rng as range)
把这句去掉就行了,还有一个问题

  Cells.ClearFormats
这个是清除所有格式,
回复

使用道具 举报

发表于 2011-12-6 10:59 | 显示全部楼层
本帖最后由 高 于 2011-12-6 11:01 编辑

Sub text()
Dim rng As Range
For Each rng In Range("a1", "a10")
If rng Is Nothing Then
Cells.ClearFormats
Else
rng.ClearFormats
End If
Next
End Sub
你的代码有两个问题,1、第一行Sub text()的括号中应该是空的
2、你没指定rng的范围,即不知道rng指哪些单元格。

回复

使用道具 举报

发表于 2011-12-6 11:06 | 显示全部楼层
看着你的意思是清除单元格格式,如果清除所有单元格的格式,下面的代码就行了
Sub text()
Cells.ClearFormats
End Sub

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|Excel精英培训 ( 豫ICP备11015029号 )

GMT+8, 2024-5-26 07:01 , Processed in 0.354606 second(s), 7 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表