View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Barb Reinhardt Barb Reinhardt is offline
external usenet poster
 
Posts: 3,355
Default Cells(my_crt_row,my_crt_col+1) crashes for my_crt_row65536

I'd add something like this

Dim aWS as Excel.Worksheet
Dim myLastRow as long
Set aWS = ActiveSheet

myLastRow = aWS.Rows.Count

Replace 65536 with myLastRow and it should work.

This way you're covered if you use it in 2003 or 2007. FWIW, you probably
have the workbook opened in 2007, but it's in a compatible version.
--
HTH,

Barb Reinhardt



"BEDE" wrote:

I tried this in Excel 2007, where the worksheets may have 1M rows.
Why does this crash?
In Excel 2000 to 2003, this thing worked fine for my_crr_row<=65536, as I
expected. But now, having more rows in a sheet, why does this not work for a
larger row number?