Compile Error Loop Without Do Excel Vba
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and excel vba compile error next without for policies of this site About Us Learn more about Stack Overflow the excel vba compile error variable not defined company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags excel vba compile error in hidden module 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; it only excel vba compile error object library invalid takes a minute: Sign up Loop Without Do Error up vote 0 down vote favorite I am trying to loop through three lists of data and hide the rows that have a total value of 0. Although I keep getting A "Loop Without Do" error, can someone spot what I have done wrong. Cheers. Sub Button1_Click() Dim Brow1 As Integer Dim
Excel Vba Compile Error Invalid Qualifier
Brow2 As Integer Dim Brow3 As Integer Dim Trow1 As Integer Dim Trow2 As Integer Dim Trow3 As Integer Brow1 = 62 Trow1 = 3 Brow2 = 126 Trow2 = 67 Brow3 = 190 Trow3 = 131 Do While Brow1 > Trow1 If Range("P" & Brow1).Value = 0 Then Rows(Brow1).EntireRow.Hidden = True ElseIf Range("P" & Brow1).Value <> 0 Then Brow1 = Brow1 - 1 Loop Do While Brow2 > Trow2 If Range("P" & Brow2).Value = 0 Then Rows(Brow2).EntireRow.Hidden = True ElseIf Range("P" & Brow2).Value <> 0 Then Brow2 = Brow2 - 1 Loop Do While Brow3 > Trow3 If Range("P" & Brow3).Value = 0 Then Rows(Brow3).EntireRow.Hidden = True ElseIf Range("P" & Brow3).Value <> 0 Then Brow3 = Brow3 - 1 Loop End Sub excel vba compiler-errors do-while share|improve this question edited Jun 25 '15 at 19:14 asked Jun 25 '15 at 19:10 Ori Meir 265 add a comment| 2 Answers 2 active oldest votes up vote 2 down vote None of your If statements are closed appropriately. Add an "End If" after each "ElseIF" and you should get your expected beh
Do 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
Excel Vba Compile Error Method Or Data Member Not Found
register link above to proceed. To start viewing messages, select the forum that excel vba compile error can't find project or library you want to visit from the selection below. Results 1 to 8 of 8 Thread: [RESOLVED] Compile Error:Loop Without Do excel vba compile error ambiguous name detected Tweet Thread Tools Show Printable Version Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Mar 8th, 2011,02:27 PM #1 tribeorange View Profile View Forum Posts Thread http://stackoverflow.com/questions/31058833/loop-without-do-error Starter New Member Join Date Mar 2011 Posts 12 [RESOLVED] Compile Error:Loop Without Do I get a compile error saying, Loop Without do. I really have no idea what that means. I'd appreciate any help i could get. Code: ' ok? If ((WeekdayName(Weekday(LoanExpiryDate - 1)) = "Saturday") Or (WeekdayName(Weekday(LoanExpiryDate - 1)) = "Sunday") Or (libraryopendate = False)) Then ' no good! either the date we're trying http://www.vbforums.com/showthread.php?643561-RESOLVED-Compile-Error-Loop-Without-Do is in a weekend or its when the library is open, add one onto the date and try again LoanExpiryDate = LoanExpiryDate + 1 Else dateok = True End If Loop End Sub Reply With Quote Mar 8th, 2011,02:36 PM #2 MartinLiss View Profile View Forum Posts Former Admin/Moderator Join Date Sep 1999 Location San Jose, CA Posts 32,948 Re: Compile Error:Loop Without Do Welcome to VBForums. You need a Do to go along with the loop. I'm not sure where you want it to be but this would compile: Code: Do If ((WeekdayName(Weekday(LoanExpiryDate - 1)) = "Saturday") Or (WeekdayName(Weekday(LoanExpiryDate - 1)) = "Sunday") Or (libraryopendate = False)) Then ' no good! either the date we're trying is in a weekend or its when the library is open, add one onto the date and try again LoanExpiryDate = LoanExpiryDate + 1 Else dateok = True End If Loop Do not worry about your difficulties in Mathematics. I can assure you mine are still greater. Albert EinsteinTips, Examples & Tutorials: A valuable forum tool • Generate unique TreeView keys • TreeView with "open" and "closed folder" icons • Time code using GetTickCount • How to trap the Tab
VBA Code & Other Help Excel Help Solved: Compile Error loop without do If this is your first visit, be sure to check out the FAQ by clicking the link http://www.vbaexpress.com/forum/showthread.php?37603-Solved-Compile-Error-loop-without-do 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 7 of 7 Thread: Solved: Compile Error loop without do Thread Tools Show Printable Version Subscribe to this Thread… Display Linear Mode Switch to compile error Hybrid Mode Switch to Threaded Mode 05-29-2011,02:11 AM #1 farrukh View Profile View Forum Posts View Blog Entries View Articles VBAX Regular Joined Jan 2011 Posts 61 Location Solved: Compile Error loop without do Dear All, Help me i am trying to make a code but get error "Compile Error loop without do" Sub test() Dim strFile As String, strFolder As excel vba compile String Dim wb As Workbook, ws As Worksheet strFolder = "c:\temp\" strFile = Dir(strFolder & "*.xl*", vbNormal) Do While strFile <> "" Set wb = Workbooks.Open(strFolder & strFile) Set ws = wb.Sheets(2) For Each wb In wb.Worksheet ' For Each strFile In wb.Files If wb.strFile Like "*.xls*" Then 'Your current code here with the below changes ws.Unprotect Chr(i) & Chr(j) & Chr(k) & _ Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _ Chr(i4) & Chr(i5) & Chr(i6) & Chr(n) If ws.ProtectContents = False Then MsgBox "One usable password is " & Chr(i) & Chr(j) & _ Chr(k) & Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & _ Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n) ws.Range("A1") = Chr(i) & Chr(j) & _ Chr(k) & Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & _ Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n) End If End If Exit Sub wb.Close True strFile = Dir Loop 'End If End Sub Formatting tags added by mark007 Regards, farrukh Last edited by xld; 05-29-2011 at 02:46 AM. Reason: Add