Excel精英培训网

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

[已解决]function函数

[复制链接]
发表于 2012-3-23 21:25 | 显示全部楼层 |阅读模式
function  aa(rg)
aa=rg.clearformats
end function这样写怎么不对呢?
最佳答案
2012-3-23 22:02
本帖最后由 adders 于 2012-3-23 09:03 编辑

I hope you don't mind me typing in English as I'm at work...

Don't confuse Function as oppose to Sub. A Function always returns a VALUE, while a Sub is a set of procedures/actions that works as it's designed.

In a nutshell, 函数返回的结果应该是一个值.

Also refer to my response to this thread:
http://www.excelpx.com/forum.php?mod=viewthread&tid=212965&page=1#pid2977148
excel精英培训的微信平台,每天都会发送excel学习教程和资料。扫一扫明天就可以收到新教程
发表于 2012-3-23 21:41 | 显示全部楼层
ms方式不对哦?

按你这思路来说,如果我们要清除 A1 里的值,写成自定义函数
Function aa(rg As Range)   参数 rg 输入A1
  aa = rg.ClearContents    '这样的?能行?'
End Function

如果是删除呢??
aa=rg.delete   这样的?


回复

使用道具 举报

发表于 2012-3-23 22:02 | 显示全部楼层    本楼为最佳答案   
本帖最后由 adders 于 2012-3-23 09:03 编辑

I hope you don't mind me typing in English as I'm at work...

Don't confuse Function as oppose to Sub. A Function always returns a VALUE, while a Sub is a set of procedures/actions that works as it's designed.

In a nutshell, 函数返回的结果应该是一个值.

Also refer to my response to this thread:
http://www.excelpx.com/forum.php?mod=viewthread&tid=212965&page=1#pid2977148
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-17 16:10 , Processed in 0.204144 second(s), 7 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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