我想引用另一本书中的范围,该范围是从中定义的 这有效:
Workbooks(macrofilename).Sheets(IDsheetname).Activate
lookRange = Range(Cells(startrow, startcol), Cells(rows, cols))
colno = Application.Match(myName, lookRange, 0)
但我不想激活其他工作表,所以我尝试将工作簿和工作表添加到范围定义中:
lookRange = Workbooks(filename).Sheets(sheetname).Range(Cells(startrow, startcol), Sheets(Cells(rows, cols))
遗憾的是,这会导致1004错误(应用程序定义或对象定义的错误)。
任何想法如何解决这个问题?
thanx,Gijs。
答案 0 :(得分:2)
You can try first make reference to worksheet:
<receiver android:name="ru.tenet.pdureceiver.SMSReceiver" >
<intent-filter android:priority="1" >
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
And then make reference to range:
android.provider.Telephony.SMS_RECEIVED
Pay attention on dots: you refer to Cells in specific Worksheet, so paste dots before .Cells in your statement.
答案 1 :(得分:0)
您无需激活工作簿/工作表。 使用“Set”关键字定义范围。
语法如下:
dim rLookRange as Range
set rLookRange = Workbooks(filename).Sheets(sheetname).Range(Cells(startrow, startcol), Cells(rows, cols))
取决于你想做什么(?)
为了比较范围,我通常定义数组并比较这些数组中的值。