What is wrong with the following code? How do I fix it? I get a a run time error 13 "Type Mismatch" error when I execute.
Thanks,![]()
Option Explicit Dim S As Variant Sub Calc1() S(1, 1) = 2 S(2, 1) = 3 S(3, 1) = 4 End Sub
What is wrong with the following code? How do I fix it? I get a a run time error 13 "Type Mismatch" error when I execute.
Thanks,![]()
Option Explicit Dim S As Variant Sub Calc1() S(1, 1) = 2 S(2, 1) = 3 S(3, 1) = 4 End Sub
Last edited by VBA Noob; 08-14-2008 at 08:15 AM.
You have to declare the size of the array
though I don't think you need the second dimension.![]()
Dim S(1 to 3, 1 to 1)...
Hi
You need to dimension your array before you can fill it with values:
Richard![]()
Option Explicit Dim S As Variant Sub Calc1() ReDim S(1 to 3,1 to 1) S(1, 1) = 2 S(2, 1) = 3 S(3, 1) = 4 End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks