Excel Visual Basic Compile Error Expected
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the visual basic compile error expected end of statement workings and policies of this site About Us Learn more about Stack compile error expected end sub excel vba Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs
Excel Vba Compile Error Expected =
Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them;
Excel Vba Compile Error Expected Array
it only takes a minute: Sign up VBA returning error when calling a Sub with multiple parameters up vote 9 down vote favorite 2 I'm trying to figure out why VBA is returning an error (Compile error: Expected: =)when I call a Sub and supply it with multiple parameters. Any help would be highly appreciated. Sub customerController(cleanStructure As Boolean, excel vba compile error variable not defined firstCol As Integer, latCol As Integer, _ lngCol As Integer, Optional startRow As Long, Optional endRow As Long) Dim i As Long, j As Long, n As Long If (cleanStructure = False) Then 'customer data type If (startRow = "") Then i = 1 If (endRow = "") Then j = countRows For n = i To j - i + 1 generateURL(n, firstCol) newReadXMLData (url) ActiveSheet.Cells(i, latCol).Value = lat ActiveSheet.Cells(i, lngCol).Value = lng Next End If End Sub The Sub that I'm calling requires two parameters: Sub generateURL(row As Long, column As Long) excel vba excel-vba share|improve this question edited Mar 28 '15 at 10:12 brettdj 38.7k1563110 asked Nov 29 '12 at 11:00 MartinUKPL 1232313 2 can you post the code for how you are calling it? You have posted customerController but referring to readAddress? –InContext Nov 29 '12 at 11:07 Oops, I posted the wrong function in the last line. I get the error in the generateURL(n,firstcol) line. –MartinUKPL Nov 29 '12 at 11:13 change generateURL(n, firstCol) to generateURL
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company
Excel Vba Compile Error In Hidden Module
Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs excel vba compile error object library invalid Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, excel vba compile error invalid qualifier just like you, helping each other. Join them; it only takes a minute: Sign up vba 'Compiler error expected: =' on saveAs operation up vote 4 down vote favorite 1 The following line in my VBA code http://stackoverflow.com/questions/13624279/vba-returning-error-when-calling-a-sub-with-multiple-parameters is generating the compile error 'Compiler error expected: =' implying that it expected an assignment. What am I doing wrong and how do I fix this? I just want to save the file. Also, I want to overwrite the file which was previously a .xls or .xlsx file. Will this line do that? Workbooks(theFile).SaveAs("Z:\test\vhb\" & newName, xlCSV) excel vba compiler-errors save-as share|improve this question edited Mar 9 '14 at 16:36 Simon Adcock 2,97131635 asked http://stackoverflow.com/questions/9230381/vba-compiler-error-expected-on-saveas-operation Feb 10 '12 at 15:41 Brian 41861225 add a comment| 1 Answer 1 active oldest votes up vote 13 down vote accepted You do not use parentheses unless you are assigning to a variable. Workbooks(theFile).SaveAs "Z:\test\vhb\" & newName, xlCSV share|improve this answer answered Feb 10 '12 at 15:49 Fionnuala 77.1k665110 Thanks, it didn't make sense to me to assign my saving. –Brian Feb 10 '12 at 16:07 4 @Brian if you really want to use the parentheses you can use Call: Call Workbooks(theFile).SaveAs("Z:\test\vhb\" & newName, xlCSV) -- but I have to say I really don't like this approach, because it adds nothing other than verbosity. –phoog Feb 10 '12 at 18:20 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and terms of service. Not the answer you're looking for? Browse other questions tagged excel vba compiler-errors save-as or ask your own question. asked 4 years ago viewed 18113 times active 2 years ago Related 1EXCEL VBA Error: “Compile Error: Expected Array”1SaveAs command does not work, but SaveCopyAs does0Formatting errors when SavingAs text fil
soon) Ruby (coming soon) Getting Started Code Samples Resources Patterns and Practices App Registration Tool Events Podcasts Training API Sandbox Videos Documentation Office Add-ins Office Add-in Availability Office Add-ins Changelog Microsoft Graph API Office 365 https://msdn.microsoft.com/en-us/library/office/gg264699.aspx Connectors Office 365 REST APIs SharePoint Add-ins Office UI Fabric Submit to the Office http://www.vbforums.com/showthread.php?736775-RESOLVED-Visual-basic-S-error-quot-Compile-Error-Expected-End-Sub-quot-and-where-it-comes Store All Documentation https://www.yammer.com/ http://feeds.feedburner.com/office/fmNx Office VBA language reference Visual Basic language reference Error Messages Error Messages Expected Sub, Function, or Property Expected Sub, Function, or Property Expected Sub, Function, or Property #Else clause must be preceded by a matching #If #Else If, #Else, or #End If must be preceded by a matching #If #ElseIf compile error must be preceded by a matching #If or #ElseIf and followed by an #ElseIf, #Else, or #End If
" Compile Error : Expected End Sub" and where it comes? If 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 the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. Results 1 to 11 of 11 Thread: [RESOLVED] Visual basic'S error " Compile Error : Expected End Sub" and where it comes? Tweet Thread Tools Show Printable Version Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Oct 2nd, 2013,07:52 AM #1 ilke View Profile View Forum Posts Thread Starter New Member Join Date Oct 2013 Posts 7 [RESOLVED] Visual basic'S error " Compile Error : Expected End Sub" and where it comes? Please can someone tell me where i am making mistake? Visual basic is giving error , it is sayin " Compile Error : Expected End Sub " I am new with this program. I searched on the internet. I am using Private Sub or function wrongly i think. I put end but it still saying "End Sub". Codes: Private Sub Form_Load() Dim i As Integer Dim x(1 To 100) As Double ir = 0 x(1) = 2: x(2) = 3: AERROR = 0.001 Public Function f(ByVal x As Double) As Double fx(i - 2) = x(i - 2) ^ 2 fx(i - 1) = x(i - 1) ^ 2 End Function End Sub Public Sub Calculate_Click() For i = 3 To 100 x(i) = x(i - 1) - ((fx(i - 1) * (x(i - 1) - x(i - 2))) / (fx(i - 1) - fx(i - 2))) If Abs(x(i) - x(i - 1)) < AERROR Then GoTo Solution ir = ir + 1 Next i Solution Print Sonuç = x(i), ir End Sub Reply With Quote Oct 2nd, 2013,08:15 AM #2 techgnome View Profile View Forum Posts PowerPoster Join Date May 2002 Posts 29,804 Re: Visual basic'S error " Compile Error : Expected End Sub" and where it comes? you're trying to put a function inside of a sub... you can't do that... also, your function as it is, doesn't return anything... further complicating it, your function uses a variable array fx that's undefined... the short of it, there's a lot more than just a "missing" end sub here... I'd try to fix it, but I don't know what it's doing, what it's supposed to do or what fx() is supposed to be... so I'm not sure where to start. -tg * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.* * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.* * How to get EFFECTIVE help: The Hitchhiker's Guide to Getti