VBA中的范围不接受双重声明价值吗?

发布于 2025-01-26 01:50:20 字数 436 浏览 3 评论 0原文

我有以下代码,其中我从命名范围中选择一个值,然后将其存储在称为双重的变量中。后来,更改变量后,我想将其重新分配到命名范围。但是在这里,我遇到了溢出错误。如果我将变量更改为整数,则错误会消失。有关信息,我正在使用Mac。

'''

Dim maxDepth As Double
i=0

Do Until Range("scopeID").offset(i, 0) = ""
    maxDepth = Range("currentDepth").offset(i, 0)

    ' some code here that possibly changes the value based on some conditions

    Range("currentDepth").offset(i, 0) = maxDepth
    i = i + 1
Loop

'''

I have the following code where I pick a value from a named range and store it in a variable declared as a Double. Later on, after changing the variable or not I want to reassign it to the named range. But here I get an Overflow error. The error disappears if I change the variable into an Integer. For information, I am working on a Mac.

'''

Dim maxDepth As Double
i=0

Do Until Range("scopeID").offset(i, 0) = ""
    maxDepth = Range("currentDepth").offset(i, 0)

    ' some code here that possibly changes the value based on some conditions

    Range("currentDepth").offset(i, 0) = maxDepth
    i = i + 1
Loop

'''

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文