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

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
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,215,181
Messages
6,123,513
Members
449,101
Latest member
mgro123

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