Compile Error Loop Without Do Visual Basic
Contents |
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 Business
Compile Error Loop Without Do Excel Vba
Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation compile error loop without do access Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like microsoft visual basic compile error you, helping each other. Join them; it only takes a minute: Sign up Loop without Do error up vote 5 down vote favorite I'm trying to implement a simple Newton's method iterative solver using Excel VB (I
Visual Basic Compile Error User Defined Type Not Defined
have never used VB.) I keep getting the error loop without a Do and I can't figure out what I'm doing wrong here. I'm trying to find the roots of the function z^3 - z^2 - (B^2 + B - A)z - A*B called the compressibility factor. My source MSN Function zCalculation(ByVal temp As Double, ByVal press As Double) As Double Dim tempCr As Double Dim pressCr As Double Dim A As Double Dim B As
Visual Basic Compile Error Sub Or Function Not Defined
Double tempCr = temp / 238.5 pressCr = press / 547.424092 A = pressCr / tempCr A = A / (9 * (2 ^ (1 / 3) - 1)) B = pressCr / tempCr B = B * (2 ^ (1 / 3) - 1) / 3 Dim zNot As Double Dim counter As Integer counter = 0 zNot = 1# Do counter = counter + 1 zNot = zNot - (zNot ^ 3 - zNot ^ 2 - (B ^ 2 + B - A) * zNot - A * B) / (3 * zNot ^ 2 - 2 * zNot - (B ^ 2 + B - A)) If counter > 1000 Then Exit Do Loop Until eval(zNot, A, B) < 0.000001 zCalculation = zNot End Function break Function eval(ByVal z As Double, ByVal A As Double, ByVal B As Double) As Double eval = z ^ 3 - z ^ 2 - (B ^ 2 + B - A) * z - A * B End Function excel-vba share|improve this question edited Dec 10 '13 at 15:20 asked Dec 9 '13 at 16:58 Felix Castor 7721522 add a comment| 2 Answers 2 active oldest votes up vote 9 down vote accepted You need an: End If in your code. share|improve this answer answered Dec 9 '13 at 17:04 Gary's Student 4
be down. Please try the request again. Your cache administrator is webmaster. Generated Thu, 06 Oct 2016 00:04:51 GMT by s_hv1002 (squid/3.5.20)
Way | Trading Add-ins For Excel | Convert Excel Into Calculating Web Pages Excel Web Pages | Produce Clean Efficient VBA Code Every Time | Build Automated Trading Models In Excel | Excel Web Pages http://www.ozgrid.com/forum/showthread.php?t=55787 | Excel Video Training Forum New Posts FAQ Calendar Forum Actions Mark Forums Read Quick Links Today's Posts What's New? Advanced Search Forum HELP FORUMS Excel General Error: Loop without Do Excel Training / Excel Dashboards Reports http://www.mrexcel.com/forum/excel-questions/35620-can-you-see-my-error-%3E-%22loop-without-do%22.html 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 compile error viewing messages, select the forum that you want to visit from the selection below. If you don't like Google AdSense in the posts, register or log in above. Click here to view the relaunched Ozgrid newsletter. Results 1 to 3 of 3 Thread: Error: Loop without Do Thread Tools Show Printable Version Search Thread Advanced Search August 15th, 2006 #1 sheid View Profile View Forum Posts I agreed to these rules Join Date visual basic compile 8th August 2006 Posts 4 Error: Loop without Do I was using Loop without trouble until I used If...Else inside the Do...Loop. The error I get is: Loop without Do. Why is that? VB: Sub Macro3() (doing something) Do Until (statement) (doing something) If (statement) Then (doing something) Else (doing something) Loop End Sub Excel Video Tutorials / Excel Dashboards Reports Reply With Quote August 15th, 2006 #2 xlite View Profile View Forum Posts Visit Homepage Long Term Member Join Date 13th September 2003 Location Singapore Posts 1,236 Re: error: Loop without Do you missed out the End If statement: VB: Sub Macro3() (doing something) Do Until (statement) (doing something) If (statement) Then (doing something) Else (doing something) End If Loop End Sub Cheers ___________ Xlite All you need to learn VBA is an internet connection and Ozgrid.com Reply With Quote August 15th, 2006 #3 sheid View Profile View Forum Posts I agreed to these rules Join Date 8th August 2006 Posts 4 Re: error: Loop without Do thanks alot. stupid stupid me : D Excel Video Tutorials / Excel Dashboards Reports Reply With Quote Quick Navigation Excel General Top Site Areas Settings Private Messages Subscriptions Who's Online Search Forums: Forums Home Forums HELP FORUMS Excel General Excel VBA / Macros Excel Formulas Excel FAQ HIRE HELP OTHE
Forums Excel Questions Can you see my error? -> "Loop without Do" Results 1 to 8 of 8 Can you see my error? -> "Loop without Do"This is a discussion on Can you see my error? -> "Loop without Do" within the Excel Questions forums, part of the Question Forums category; I'm fairly new to learning how to write VBA code in Excel. I've been looking at this snippet for some ... LinkBack LinkBack URL About LinkBacks Bookmark & Share Digg this Thread!Add Thread to del.icio.usBookmark in TechnoratiTweet this thread Thread Tools Show Printable Version Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Jan 22nd, 2003,04:18 PM #1 Sunrise New Member Join Date Apr 2002 Posts 5 I'm fairly new to learning how to write VBA code in Excel. I've been looking at this snippet for some time now but unable to correct the Loop error I keep getting. It keeps saying "Loop without Do" but there is a complete "Do Until..Loop" present as far as I can see. If you see the error can you show me where it is? Thanks in advance for for any help you might offer. //////////////////////////// Sub UpdateRegion() Dim cell As Range 'set the range variable cell to ActiveCell Set cell = ActiveCell Do Until (cell = Range("C1600")) 'test to see if all the next cell is empty, 'exit the loop if it is If IsEmpty(cell) _ Then Set cell = cell.Offset(1, 0) Else If (((cell.Value)="Surrey")Or _ ((cell.Value)="Delta")Or _ ((cell.Value)="Vancouver")Or _ ((cell.Value)="Port Moody")Or _ ((cell.Value)="Port Coquitlam")Or _ ((cell.Value) = "Delta")Or _ ((cell.Value) = "Chilliwack")Or _ ((cell.Value) = "Richmond")Or _ ((cell.Value) = "Langley")Or _ ((cell.Value) = "Coquitlam")Or _ ((cell.Value) = "Campbell River")Or _ ((cell.Value) = "Port Alberni")Or _ ((cell.Value) = "Duncan")Or _ ((cell.Value) = "Maple Ridge")Or _ ((cell.Value) = "Nanaimo")Or _ ((cell.Value)="New Westminster")Or _ ((cell.Value) = "Abbotsford")Or _ ((cell.Value) = "Victoria")Or _ ((cell.Value) = "Squamish")Or _ ((cell.Value) = "Pitt Meadows")Or _ ((cell.Value) = "Burnaby")) _ Then cell.Offset(0, 3).Value = "1" Set cell = cell.Offset(1, 0) Else