下标超出范围 - 如何分配变量来引用工作表中的单元格 [英] Subscript out of range - how to assign variable to reference the cell in a worksheet

查看:166
本文介绍了下标超出范围 - 如何分配变量来引用工作表中的单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更正assigna变量来存储对单元格的引用?最后一行抛出下标超出范围错误

How do you correct assigna variable to store the reference to the cell ? Last line throws Subscript out of range error

Public Sub CommandButton1_Click()

Dim variance As Range
Dim risk As Range
Dim time As Range
Dim output As Range

variance = Sheets("ABC").Range("C6")


推荐答案

设置方差=表(ABC) .Range(C6)

+

vba中的dim和set之间的区别是什么

+

下标超出范围意味着您没有名为 ABC 或拼写/外壳是不同的。确保它不是 Abc ABc 等。

Subscript out of range means you do not have a sheet named ABC or the spelling/casing is different. Make sure it's not an Abc or ABc etc.

这篇关于下标超出范围 - 如何分配变量来引用工作表中的单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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