Loop missing do. but do is not missing
-
Please help Tom I am putting my full code below. I can't seem to find the problem. As soon as it tries to compile it throws the error Loop missing Do. Thank you so much for answering my prior question so quickly! Sub Extract_Totals() ? Application.ScreenUpdating = False MsgBox "The Operation will now begin. The screen will appear to freeze." & vbNewLine & "This may take a few minutes...", vbOKOnly, "Notice..." ? 'All Variable Definitions ? 'MAIN CUSTOMER INFORMATION Dim TELESIS As String Dim CUSTOMER As String Dim WORKORDER As String Dim SALESORDER As String Dim MODEL_NUM As String Dim CT_NUM As String ? 'Remaining Variables Dim x As Integer Dim total_rows As Integer Dim RunningLocation As String Dim COMMAND_count As Integer Dim SelectedWorkbook As String Dim WorkBookPath As String Dim mWorkbooks() As String, mNumberOfWorkbooks As Long, mWorkbookCounter As Long Dim mValuesFound() As String, mValueFoundCounter As Long, mCounter As Long Dim mWorkbookFoundIn() As String Dim mWorksheetFoundIn() As String Dim ValueOFFSET_Row As Long Dim ValueOFFSET_Col As Long Dim mSheetCount As Long, mSheetCounter As Long Dim mFoundAddress As String Dim VbMsgBoxResult As String Dim MsgBoxErrorCount As Integer Dim arrDATA() As String Dim numDataFields As Integer Dim runningOffset As Integer Dim insertionCounter As Integer Dim cl As Range Dim clAddress As String ? 'Postion Calculation Variables for Offsets (Duplicate ID Section) Dim intLength As Integer Dim strPosition As String ? 'Define program staring variable values COMMAND_count = 0 MsgBoxErrorCount = 0 numDataFields = 5 ? '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 'Open all needed Workbooks ? mNumberOfWorkbooks = 3 ReDim mWorkbooks(1 To mNumberOfWorkbooks) ??? ??? '///////////////////////////////////////////// ??? 'YOU MUST SPECIFY YOUR WORKBOOK LOCATIONS HERE ??? '///////////////////////////////////////////// ??? mWorkbooks(1) = "P:Telesis NumbersSuspension Welder D-Side Data.xls" ??? mWorkbooks(2) = "P:Telesis NumbersSW 3E macro telesis 6-17-10.xls" ??? mWorkbooks(3) = "P:Telesis NumbersSW2A penetration 6-15-10.xls" ? mWorkbookCounter = 1 Do While mWorkbookCounter "" Then CT_NUM = ActiveCell.Offset(0, 1) ??? If ActiveCell.Offset(0, 2) <> "" Then WORKORDER = ActiveCell.Offset(0, 2) ??? If ActiveCell.Offset(0, 3) <> "" Then SALESORDER = ActiveCell.Offset(0, 3) ??? If ActiveCell.Offset(0, 4) <> "" Then MODEL_NUM = ActiveCell.Offset(0, 4) ??? If ActiveCell.Offset(0, 5) <> "" Then CUSTOMER = ActiveCell.Offset(0, 5) ??? ??? ''''''''''''' PROGRAM END SEQUENCE '''''''''''''''''??? 'End program when no telesis numbers remain. ??? If TELESIS = "" Then ??????? 'Close all workbooks opened by Macro Program ??????? mWorkbookCounter = 1 ??????? Do While mWorkbookCounter "" Then ??????????????????????????????? mValueFoundCounter = mValueFoundCounter + 1 ??????????????????????????????????? ??????????????????????????????? Range(mFoundAddress).Activate ??????????????????????????????? If ActiveCell.Value = TELESIS Then ??????????????????????????????????? ReDim arrDATA(1 To numDataFields) ??????????????????????????????????????? arrDATA(1) = CUSTOMER ??????????????????????????????????????? arrDATA(2) = WORKORDER ??????????????????????????????????????? arrDATA(3) = SALESORDER ??????????????????????????????????????? arrDATA(4) = MODEL_NUM ??????????????????????????????????????? arrDATA(5) = CT_NUM ??????????????????????????????????????????? ??????????????????????? ????????insertionCounter = 1 ??????????????????????????????? Do While insertionCounter mFoundAddress And cl.Address > mFoundAddress ??????????????????? End If ??????????????? End With ??????????? On Error GoTo 0 ??? ??????? 'Search Next Sheet in file if enabled. ??????? Next mSheetCounter ? ??? 'Search Next Workbook ??? Next mWorkbookCounter ? 'Search Next TELESIS number Next x ? End Sub
-
Answer:
this line If ActiveCell.Value = TELESIS Then doesn't seem to have a terminating End If statement and that throws very thing out of kilter If I do this Range(mFoundAddress).Activate If ActiveCell.Value = TELESIS Then ReDim arrDATA(1 To numDataFields) arrDATA(1) = CUSTOMER arrDATA(2) = WORKORDER arrDATA(3) = SALESORDER arrDATA(4) = MODEL_NUM arrDATA(5) = CT_NUM End If ' then it compiles OK - but I have no idea what the scope of that IF statement should be/ where the End If shoulda actually be. Best I can do is show you where the error is.
Miningco.com Visit the source
Related Q & A:
- Did they ever find the missing link in human evolution?Best solution by telegraph.co.uk
- Would it be realistically possible to find our missing half-sibling in Japan?Best solution by Yahoo! Answers
- How to track a missing money order?Best solution by eHow old
- What is the difference between a for loop, a do while loop and a do loop?Best solution by wiki.answers.com
- Missing multimedia audio controller.Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.