本文介绍了在VBA中为字符串使用cells()时出错?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
因此,我尝试使用Cells对象存储字符串,并且不断收到应用程序错误:
So I am trying to use the Cells object to store a string and I keep getting an application error:
Sub analyze()
Dim rC As Integer
Dim rtData As Worksheet
Set rtData = ThisWorkbook.Sheets("RTN Data")
Dim finalSht As Worksheet
Set finalSht = ThisWorkbook.Sheets("Final")
Sheets("Final").Cells(1, 1).Text = "order#"
finalSht.Cells(0, 2) = "Nurse"
finalSht.Cells(0, 3) = "Message"
rC = rtData.Cells(rows.Count, 1).End(xlUp).Row
End Sub
不管我如何继续尝试引用它
Regardless of the different ways i keep trying to reference it
请帮助.
推荐答案
.text是只读属性.尝试将您的值分配给.value
.text is a read only property. Try assigning your value to .value
此外,单元格从1开始计数,因此cell(0,2)毫无意义.
Also, cells are counted from 1, so cells(0,2) makes no sense.
Sheets("Final").Cells(1, 1).Value = "order#"
finalSht.Cells(1, 2) = "Nurse"
finalSht.Cells(1, 3) = "Message"
这篇关于在VBA中为字符串使用cells()时出错?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!