ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Select Method Failing (https://www.excelbanter.com/excel-programming/334204-select-method-failing.html)

cmk18[_8_]

Select Method Failing
 

Does anyone know a common cause of/solution to the Select Method of
Range Object failing. I'm running this code during the deactivat
subfunction:

cRow = Range("$A:$A").Cells(Rows.Count, 1).End(xlUp).Row
Range(Cells(2, 1), Cells(cRow, 2)).Select

This code worked last week, but this week it has decided to break.

Cheers-
Chris Krah

--
cmk1
-----------------------------------------------------------------------
cmk18's Profile: http://www.excelforum.com/member.php...nfo&userid=604
View this thread: http://www.excelforum.com/showthread.php?threadid=38624


JE McGimpsey

Select Method Failing
 
When you set a breakpoint and step through the code, what does cRow
evaluate to?

In article ,
cmk18 wrote:

Does anyone know a common cause of/solution to the Select Method of a
Range Object failing. I'm running this code during the deactivate
subfunction:

cRow = Range("$A:$A").Cells(Rows.Count, 1).End(xlUp).Row
Range(Cells(2, 1), Cells(cRow, 2)).Select

This code worked last week, but this week it has decided to break.


Tom Ogilvy

Select Method Failing
 
The deactivate event fires after the sheet with the code has lost the focus.
Thus you get the error because you can not select on that sheet.

As written, you must be mistaken. It has probably never worked in the
deactivate event.

It is unclear where you are trying to select so not sure what to recommend.

--
Regards,
Tom Ogilvy

"cmk18" wrote in
message ...

Does anyone know a common cause of/solution to the Select Method of a
Range Object failing. I'm running this code during the deactivate
subfunction:

cRow = Range("$A:$A").Cells(Rows.Count, 1).End(xlUp).Row
Range(Cells(2, 1), Cells(cRow, 2)).Select

This code worked last week, but this week it has decided to break.

Cheers-
Chris Krahe


--
cmk18
------------------------------------------------------------------------
cmk18's Profile:

http://www.excelforum.com/member.php...fo&userid=6047
View this thread: http://www.excelforum.com/showthread...hreadid=386242





All times are GMT +1. The time now is 01:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com