Compile Error Expected Array Access
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions compile error expected array in vba you might have Meta Discuss the workings and policies of this
Excel Vba Compile Error Expected Array
site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers access compile error expected = or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community
Compile Error Expected End With
of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up EXCEL VBA Error: “Compile Error: Expected Array” up vote 1 down vote favorite Can anyone help me? I have been getting a compile error (...: "Expected Array") when dealing with arrays in my Excel compile error expected identifier workbook. Basically, I have one 'mother' array (2D, Variant type) and four 'baby' arrays (1D, Double type). The called subroutine creates the publicly declared arrays which my main macro ends up using for display purposes. Unfortunately, the final of the baby arrays craps out (giving the "Compile Error: Expected Array"). Strangely, if I remove this final baby array ('final' - as in the order of declaration/definition) the 2nd to last baby array starts crapping out. Here is my code: Public Mother_Array() as Variant, BabyOne_Array(), BabyTwo_Array(), BabyThree_Array(), BabyFour_Array() as Double 'declare may other variables and arrays, too Sub MainMacro() 'do stuff Call SunRaySubRoutine(x, y) 'do stuff Range("blah") = BabyOne_Array: Range("blahblah") = BabyTwo_Array Range("blahbloh" = BabyThree_Array: Range("blahblue") = BabyFour_Array End Sub Sub SunRaySubRoutine(x,y) n = x * Sheets("ABC").Range("A1").Value + 1 ReDim Mother_Array(18, n) as Variant, BabyOne_Array(n), BabyTwo_Array(n) as Double ReDim BabyThree_Array(n), BabyFour_Array(n) as Double 'do stuff For i = 0 to n BabyOne_Array(i) = Mother_Array(0,i) BabyTwo_Array(i) = Mother_Array(2,i) BabyThree_Array(i) = Mother_Arra
this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click
Compile Error Expected Identifier Or Bracketed Expression
the register link above to proceed. To start viewing messages, select the
Access Vba Compile Error Expected Array
forum that you want to visit from the selection below. Results 1 to 14 of 14 Thread: [RESOLVED] Expected vba month expected array Array??? Tweet Thread Tools Show Printable Version Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Nov 20th, 2011,11:45 AM #1 PaulTilley View Profile View Forum http://stackoverflow.com/questions/17255458/excel-vba-error-compile-error-expected-array Posts Thread Starter Addicted Member Join Date Sep 2000 Location UK Posts 199 [RESOLVED] Expected Array??? I've just tried to compile my project and all of a sudden some functions that have been working perfectly are causing a compile error: one example: Code: Public Function StripCurrSymbol(StrIn As String) As String If Left(StrIn, 1) = "£" Then StripCurrSymbol = Mid(FormatMoney(StrIn), 2) Else StripCurrSymbol = http://www.vbforums.com/showthread.php?665550-RESOLVED-Expected-Array StrIn End If End Function another example is where im using a 'right'. The error I get is Compile Error: Expected Array and it highlights 'left' any ideas? Reply With Quote Nov 20th, 2011,11:52 AM #2 lone_REBEL View Profile View Forum Posts Hyperactive Member Join Date Jan 2006 Location Pakistan Posts 388 Re: Expected Array??? Its REALLY weird! VB sometimes does absurd things to me, too. Try closing and again opening the project and see if it compiles correctly. If not (as expected), can you post the value of StrIn variable when the error raises? (Taking the mouse cursor on it will display the value) If your problem is solved, then drag down the Thread Tools and mark your thread as Resolved. If I helped you solve your problem, inflate some air into my ego by rating my post and adding a comment too. For notorious issues (elaborate yourself) contact me via PM. I don't answer them in the forums EVER. Reply With Quote Nov 20th, 2011,11:53 AM #3 Spoo View Profile View Forum Posts PowerPoster Join Date Nov 2008 Location Right Coast Posts 2,656 Re: Ex
Community Links Social Groups Pictures & Albums Members List Calendar Search Forums Show Threads Show Posts Tag Search Advanced Search Find All Thanked Posts Go to Page... Thread Tools Rate Thread Display Modes 03-08-2015, 04:17 PM #1 cc.caroline15 Newly Registered User Join Date: Oct 2014 Posts: http://www.access-programmers.co.uk/forums/showthread.php?t=275552 23 Thanks: 5 Thanked 0 Times in 0 Posts Compile error expected array Hi everyone, I was hoping someone could help me with when I click the add bottom I get Compile error expected array & it's suppouse to check for a value in both text boxes, if either one is missing a message box should let the user know that they need to provide a value for both and this part works, Also if the user tries to add more names then the one's indicated compile error on the input box a message box should let the user know the list is full and if the arrays are not full, then with a If statement within a For … Next loop to find the first element not containing data (“”) and assign the names to the respective array elements; and clear the text boxes on the form. I'm sure there is a lot of things wrong with this portion of my code, i'm having a hard time with arrays but can't figure out what. compile error expected Can you please help me?? Thank you Attached Files 240CCA06.zip (130.0 KB, 33 views) cc.caroline15 View Public Profile Find More Posts by cc.caroline15 03-08-2015, 05:44 PM #2 jdraw Super Moderator Join Date: Jan 2006 Location: Ottawa, Ontario, Canada;West Palm Beach, Florida Posts: 9,758 Thanks: 25 Thanked 1,532 Times in 1,488 Posts Re: Compile error expected array You have to dim strName as an array strName() As String __________________ To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. jdraw View Public Profile Find More Posts by jdraw 03-08-2015, 06:11 PM #3 cc.caroline15 Newly Registered User Join Date: Oct 2014 Posts: 23 Thanks: 5 Thanked 0 Times in 0 Posts Re: Compile error expected array Hi Jdraw, I fix that but I'm getting a new error Subscript out of range & it highlights this line If strName(intItems - 1) <> "" Then Could you help me please? Attached Files 240CCA06.zip (129.2 KB, 23 views) cc.caroline15 View Public Profile Find More Posts by cc.caroline15 03-08-2015, 06:54 PM #4 jdraw Super Moderator Join Date: Jan 2006 Location: Ottawa, Ontario, Canada;West Palm Beach, Florida Posts: 9,758 Thanks: 25 Thanked 1,532 Times in 1,488 Posts Re: Compile error expected array Try the Debugging Tips link in my signature ---use the step