【发布时间】:2016-11-29 11:04:25
【问题描述】:
我创建了一个存储工作表名称及其编号的字典。
所以代码如下:
Sub SetDiction()
Dim num as Excel.Range
Dim wks As Excel.Worksheet
For each wks in ThisWorkbook.Worksheets
Set num = Nothing
Set num = wks.Range("SheetNumber")
If not(num is Nothing) Then
rModule.rDictionary.Add:=num.Value Item:=wks
End If
下一步 结束子
现在正在尝试获取 wks 名称并将其放入另一个工作表中。代码是:
Sub GetSheet()
Dim key as variant
For each key in rModule.rDictionary.Keys
With Sheet2
.Cells(2,1).Value = rModule.rDictionary.Item(key)
End With
End Sub
它给了我应用程序定义或对象定义的错误。 有人可以帮忙吗?
【问题讨论】: