在单元格公式中引用公共常数 [英] Referencing Public Constants in Cell Formulas

查看:278
本文介绍了在单元格公式中引用公共常数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够在单元格公式中引用公共常量。我发现有多个引用可以从单元格值中定义常量 ,但是没有在公式中使用常量。

I would like to be able reference a public constant in a cell formula. I have found multiple references to defining constants from cell values, but not for using constants in formulas.

我希望能够做这样的事情(我知道这不是正确的语法,但是您知道了...)

I would like to be able do something like this (I know that this is not the right syntax, but you get the idea...)

="Some formula text " & myPublicConstantName

想法?

谢谢! / p>

Thank!

推荐答案

您的公共常量位于标准模块中,并且可能看起来像这样:

Your public constant lives in a standard module, and probably looks something like this:

Public Const Foo As Long = 42

您可以通过UDF公开它:

You can expose it through a UDF:

Public Function GetFoo() As Long
    GetFoo = Foo
End Function

现在您可以拥有 =某些公式文本&在工作表单元格中的GetFoo()

这篇关于在单元格公式中引用公共常数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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