Strange Behaviour: Run Time Error Application-defined or object-defined error

marc005

Board Regular
Joined
Apr 21, 2013
Messages
58
Open a macroenabled excel workbook and then run:

Public Sub wrt()

Worksheets("Sheet1").Select
Lastrow = Range("A" & Rows.Count).End(xlUp).Row
Cells(1, 1).Value = Replace(ActiveSheet.Cells(1, 10000).Address(0, 0), ActiveCell.Row, "")

End Sub

Everything works as it should. Now add another zero to 10000:

Public Sub wrt()

Worksheets("Sheet1").Select
Lastrow = Range("A" & Rows.Count).End(xlUp).Row
Cells(1, 1).Value = Replace(ActiveSheet.Cells(1, 100000).Address(0, 0), ActiveCell.Row, "")

End Sub


Run Time Error
Application-defined or object-defined error
 
Last edited:

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Excel worksheets have 16,000 columns (or 264 prior to Excel 2007). You're trying to reference column 100,000!
 
Upvote 0
I think you have got the columns confused with the rows.
You are trying to use 100,000 columns which there aren't.
I hope this helps!
 
Upvote 0
16 000 columns seems a bit low! Is it 16 000 even for excel 2010?
What I am trying to do is to transpose 650 000 rows in to 650 000 columns ha ha

Excel runs into trouble already at:

Lastrow = Range("A" & Rows.Count).End(xlUp).Row
Cells(1, Lastrow).Select
ColLetter = Replace(ActiveCell.Address(0, 0), ActiveCell.Row, "")


I might have to do my modeling elsewhere :(
 
Upvote 0
If you hold down the Ctrl key and press the Right Arrow Key, that will take you to the last column in your SpreadSheet. You can work out how many columns you have from there, it should be 16,384!

I hope this helps!
 
Upvote 0

Forum statistics

Threads
1,216,985
Messages
6,133,877
Members
449,842
Latest member
rostioschool

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top