How to properly address an ActiveSheet (error 438)

carboxyll

New Member
Joined
Oct 10, 2017
Messages
2
Hello,
I'm trying to make my first array and hitting a snag. I'm making a macro that automatically runs upon opening any Excel file. I'm having a runtime error of 438, Object doesn't support this property or method. I feel it's from incorrectly defining my active sheet. How would I properly do this?
Thanks!

Code:
Dim StrArr(89) As String, i As Integer
i = 3 ' change to start value
Do While ThisWorkbook.ActiveSheet.Cell(i, 1).Value <> ""
 StrArr(i - 3) = ThisWorkbook.ActiveSheet.Cells(i, 1).Value
 i = i + 1
Loop
MsgBox StrArr(0)MsgBox StrArr(1)MsgBox StrArr(2)MsgBox StrArr(89)
 
Last edited by a moderator:

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Welcome to the forum.

It should be Cells not Cell in this line:

Rich (BB code):
Do While ThisWorkbook.ActiveSheet.Cell(i, 1).Value <> ""
 
Upvote 0

Forum statistics

Threads
1,224,825
Messages
6,181,190
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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