Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
I "DO" have a "DO"
Hi, I have a macro that was once working...
It looks like this: Sub LectureCode() i = 5 'initialization du compteur Sheets("Principale").Select 'Lecture du code Do While Range("A" & i) < Empty (... here I have many code lines...) Loop But when I run it, it highlights the word Loop and says it has no "Do" The only things I changed since the time it was working are lines of code between this Do and Loop and I have not entered a "Loop" in there. ....Help? Also, what is the difference between Do While ... Loop and While ... Wend Marie |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
I "DO" have a "DO"
Hi
you probably have an additional loop or other end statement in your other 'many code lines' -- Regards Frank Kabel Frankfurt, Germany "Marie Lavoie" schrieb im Newsbeitrag ... Hi, I have a macro that was once working... It looks like this: Sub LectureCode() i = 5 'initialization du compteur Sheets("Principale").Select 'Lecture du code Do While Range("A" & i) < Empty (... here I have many code lines...) Loop But when I run it, it highlights the word Loop and says it has no "Do" The only things I changed since the time it was working are lines of code between this Do and Loop and I have not entered a "Loop" in there. ...Help? Also, what is the difference between Do While ... Loop and While ... Wend Marie |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
I "DO" have a "DO"
nope
"Frank Kabel" a écrit dans le message de ... Hi you probably have an additional loop or other end statement in your other 'many code lines' -- Regards Frank Kabel Frankfurt, Germany "Marie Lavoie" schrieb im Newsbeitrag ... Hi, I have a macro that was once working... It looks like this: Sub LectureCode() i = 5 'initialization du compteur Sheets("Principale").Select 'Lecture du code Do While Range("A" & i) < Empty (... here I have many code lines...) Loop But when I run it, it highlights the word Loop and says it has no "Do" The only things I changed since the time it was working are lines of code between this Do and Loop and I have not entered a "Loop" in there. ...Help? Also, what is the difference between Do While ... Loop and While ... Wend Marie |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
I "DO" have a "DO"
Hi
to be honest this answer won't help you to get a more specific response :-) How should we help you finding this error if we don't have more information. So if your macro is not that long post the omitted lines. I'm (and I think the same is true for Chip) quite sure that there's an additional line of code (e.g. 'End', 'End if', 'Loop', etc.) which does NOT have an opening statement You may check this by yourself by identing each loop / if clause -- Regards Frank Kabel Frankfurt, Germany "Marie Lavoie" schrieb im Newsbeitrag ... nope "Frank Kabel" a écrit dans le message de ... Hi you probably have an additional loop or other end statement in your other 'many code lines' -- Regards Frank Kabel Frankfurt, Germany "Marie Lavoie" schrieb im Newsbeitrag ... Hi, I have a macro that was once working... It looks like this: Sub LectureCode() i = 5 'initialization du compteur Sheets("Principale").Select 'Lecture du code Do While Range("A" & i) < Empty (... here I have many code lines...) Loop But when I run it, it highlights the word Loop and says it has no "Do" The only things I changed since the time it was working are lines of code between this Do and Loop and I have not entered a "Loop" in there. ...Help? Also, what is the difference between Do While ... Loop and While .... Wend Marie |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
I "DO" have a "DO"
here you go:
I guess my Select Case doesn't have the good syntaxe... 'Déclaration des variables Dim i As Integer 'compteur Dim NOCIBC As String ' No du dossier à la CIBC Dim ND As String ' Notre numero de dossier Dim Nom As String ' Nom du débiteur Dim DateO As Date ' Date ouverture Dim DateR As Date ' Date recouvrement Dim Montant As Currency ' Montant du recouvrement Sub LectureCode() i = 5 'initialization du compteur Sheets("Principale").Select 'Lecture du code Do While Range("A" & i) < Empty NOCIBC = Range("B" & i) ND = Range("C" & i) Nom = Range("D" & i) DateO = Range("E" & i) DateR = Range("F" & i) Montant = Range("G" & i) ---------------- beginning of new text----------------------- 'Série de tests Select Case Range("A" & i) Case "CLS" Sheets("CLS").Select Case "CLU" Sheets("CLU").Select Case "PLC" Sheets("PLC").Select ------------------end of new text-------------------------------- 'Inscription des données Range("A14").Select ' Première ligne des données de facture Selection.EntireRow.Insert ' Insertion une ligne Range("A14").FormulaR1C1 = NOCIBC Range("B14").FormulaR1C1 = ND Range("C14").FormulaR1C1 = Nom Range("D14").FormulaR1C1 = DateO Range("E14").FormulaR1C1 = DateR Range("G14").FormulaR1C1 = Montant 'Préparation à la prochaine boucle i = i + 1 Sheets("Principale").Select Loop End Sub "Frank Kabel" a écrit dans le message de ... Hi to be honest this answer won't help you to get a more specific response :-) How should we help you finding this error if we don't have more information. So if your macro is not that long post the omitted lines. I'm (and I think the same is true for Chip) quite sure that there's an additional line of code (e.g. 'End', 'End if', 'Loop', etc.) which does NOT have an opening statement You may check this by yourself by identing each loop / if clause -- Regards Frank Kabel Frankfurt, Germany "Marie Lavoie" schrieb im Newsbeitrag ... nope "Frank Kabel" a écrit dans le message de ... Hi you probably have an additional loop or other end statement in your other 'many code lines' -- Regards Frank Kabel Frankfurt, Germany "Marie Lavoie" schrieb im Newsbeitrag ... Hi, I have a macro that was once working... It looks like this: Sub LectureCode() i = 5 'initialization du compteur Sheets("Principale").Select 'Lecture du code Do While Range("A" & i) < Empty (... here I have many code lines...) Loop But when I run it, it highlights the word Loop and says it has no "Do" The only things I changed since the time it was working are lines of code between this Do and Loop and I have not entered a "Loop" in there. ...Help? Also, what is the difference between Do While ... Loop and While ... Wend Marie |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
I "DO" have a "DO"
OH.... End Select... *sigh*
Not used to those "End ..." Lol, Used to C++ ;-) Everything is ok. Thank you anyway! Marie "Marie Lavoie" a écrit dans le message de ... here you go: I guess my Select Case doesn't have the good syntaxe... 'Déclaration des variables Dim i As Integer 'compteur Dim NOCIBC As String ' No du dossier à la CIBC Dim ND As String ' Notre numero de dossier Dim Nom As String ' Nom du débiteur Dim DateO As Date ' Date ouverture Dim DateR As Date ' Date recouvrement Dim Montant As Currency ' Montant du recouvrement Sub LectureCode() i = 5 'initialization du compteur Sheets("Principale").Select 'Lecture du code Do While Range("A" & i) < Empty NOCIBC = Range("B" & i) ND = Range("C" & i) Nom = Range("D" & i) DateO = Range("E" & i) DateR = Range("F" & i) Montant = Range("G" & i) ---------------- beginning of new text----------------------- 'Série de tests Select Case Range("A" & i) Case "CLS" Sheets("CLS").Select Case "CLU" Sheets("CLU").Select Case "PLC" Sheets("PLC").Select ------------------end of new text-------------------------------- 'Inscription des données Range("A14").Select ' Première ligne des données de facture Selection.EntireRow.Insert ' Insertion une ligne Range("A14").FormulaR1C1 = NOCIBC Range("B14").FormulaR1C1 = ND Range("C14").FormulaR1C1 = Nom Range("D14").FormulaR1C1 = DateO Range("E14").FormulaR1C1 = DateR Range("G14").FormulaR1C1 = Montant 'Préparation à la prochaine boucle i = i + 1 Sheets("Principale").Select Loop End Sub "Frank Kabel" a écrit dans le message de ... Hi to be honest this answer won't help you to get a more specific response :-) How should we help you finding this error if we don't have more information. So if your macro is not that long post the omitted lines. I'm (and I think the same is true for Chip) quite sure that there's an additional line of code (e.g. 'End', 'End if', 'Loop', etc.) which does NOT have an opening statement You may check this by yourself by identing each loop / if clause -- Regards Frank Kabel Frankfurt, Germany "Marie Lavoie" schrieb im Newsbeitrag ... nope "Frank Kabel" a écrit dans le message de ... Hi you probably have an additional loop or other end statement in your other 'many code lines' -- Regards Frank Kabel Frankfurt, Germany "Marie Lavoie" schrieb im Newsbeitrag ... Hi, I have a macro that was once working... It looks like this: Sub LectureCode() i = 5 'initialization du compteur Sheets("Principale").Select 'Lecture du code Do While Range("A" & i) < Empty (... here I have many code lines...) Loop But when I run it, it highlights the word Loop and says it has no "Do" The only things I changed since the time it was working are lines of code between this Do and Loop and I have not entered a "Loop" in there. ...Help? Also, what is the difference between Do While ... Loop and While ... Wend Marie |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
I "DO" have a "DO"
Nope!
or You never end the select case construct see original comment: Could be anything that unbalances your structure. Certainly an error on your part. Since the case structure is not terminated, a Loop command is unexpected. Select Case Range("A" & i) Case "CLS" Sheets("CLS").Select Case "CLU" Sheets("CLU").Select Case "PLC" Sheets("PLC").Select End Select -- Regards, Tom Ogilvy "Marie Lavoie" wrote in message ... here you go: I guess my Select Case doesn't have the good syntaxe... 'Déclaration des variables Dim i As Integer 'compteur Dim NOCIBC As String ' No du dossier à la CIBC Dim ND As String ' Notre numero de dossier Dim Nom As String ' Nom du débiteur Dim DateO As Date ' Date ouverture Dim DateR As Date ' Date recouvrement Dim Montant As Currency ' Montant du recouvrement Sub LectureCode() i = 5 'initialization du compteur Sheets("Principale").Select 'Lecture du code Do While Range("A" & i) < Empty NOCIBC = Range("B" & i) ND = Range("C" & i) Nom = Range("D" & i) DateO = Range("E" & i) DateR = Range("F" & i) Montant = Range("G" & i) ---------------- beginning of new text----------------------- 'Série de tests Select Case Range("A" & i) Case "CLS" Sheets("CLS").Select Case "CLU" Sheets("CLU").Select Case "PLC" Sheets("PLC").Select ------------------end of new text-------------------------------- 'Inscription des données Range("A14").Select ' Première ligne des données de facture Selection.EntireRow.Insert ' Insertion une ligne Range("A14").FormulaR1C1 = NOCIBC Range("B14").FormulaR1C1 = ND Range("C14").FormulaR1C1 = Nom Range("D14").FormulaR1C1 = DateO Range("E14").FormulaR1C1 = DateR Range("G14").FormulaR1C1 = Montant 'Préparation à la prochaine boucle i = i + 1 Sheets("Principale").Select Loop End Sub "Frank Kabel" a écrit dans le message de ... Hi to be honest this answer won't help you to get a more specific response :-) How should we help you finding this error if we don't have more information. So if your macro is not that long post the omitted lines. I'm (and I think the same is true for Chip) quite sure that there's an additional line of code (e.g. 'End', 'End if', 'Loop', etc.) which does NOT have an opening statement You may check this by yourself by identing each loop / if clause -- Regards Frank Kabel Frankfurt, Germany "Marie Lavoie" schrieb im Newsbeitrag ... nope "Frank Kabel" a écrit dans le message de ... Hi you probably have an additional loop or other end statement in your other 'many code lines' -- Regards Frank Kabel Frankfurt, Germany "Marie Lavoie" schrieb im Newsbeitrag ... Hi, I have a macro that was once working... It looks like this: Sub LectureCode() i = 5 'initialization du compteur Sheets("Principale").Select 'Lecture du code Do While Range("A" & i) < Empty (... here I have many code lines...) Loop But when I run it, it highlights the word Loop and says it has no "Do" The only things I changed since the time it was working are lines of code between this Do and Loop and I have not entered a "Loop" in there. ...Help? Also, what is the difference between Do While ... Loop and While ... Wend Marie |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
I "DO" have a "DO"
Marie,
Most likely, the error is that you are missing or have an extra "End If" or other "End" statement in the code that you omitted. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Marie Lavoie" wrote in message ... Hi, I have a macro that was once working... It looks like this: Sub LectureCode() i = 5 'initialization du compteur Sheets("Principale").Select 'Lecture du code Do While Range("A" & i) < Empty (... here I have many code lines...) Loop But when I run it, it highlights the word Loop and says it has no "Do" The only things I changed since the time it was working are lines of code between this Do and Loop and I have not entered a "Loop" in there. ...Help? Also, what is the difference between Do While ... Loop and While ... Wend Marie |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
I "DO" have a "DO"
nope
"Chip Pearson" a écrit dans le message de ... Marie, Most likely, the error is that you are missing or have an extra "End If" or other "End" statement in the code that you omitted. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Marie Lavoie" wrote in message ... Hi, I have a macro that was once working... It looks like this: Sub LectureCode() i = 5 'initialization du compteur Sheets("Principale").Select 'Lecture du code Do While Range("A" & i) < Empty (... here I have many code lines...) Loop But when I run it, it highlights the word Loop and says it has no "Do" The only things I changed since the time it was working are lines of code between this Do and Loop and I have not entered a "Loop" in there. ...Help? Also, what is the difference between Do While ... Loop and While ... Wend Marie |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
I "DO" have a "DO"
Could be anything that unbalances your structure. Certainly an error on
your part. See Above None -- Regards, Tom Ogilvy "Marie Lavoie" wrote in message ... Hi, I have a macro that was once working... It looks like this: Sub LectureCode() i = 5 'initialization du compteur Sheets("Principale").Select 'Lecture du code Do While Range("A" & i) < Empty (... here I have many code lines...) Loop But when I run it, it highlights the word Loop and says it has no "Do" The only things I changed since the time it was working are lines of code between this Do and Loop and I have not entered a "Loop" in there. ...Help? Also, what is the difference between Do While ... Loop and While ... Wend Marie |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
correct syntax for nesting "if", "and", and "vlookup"....if possib | Excel Worksheet Functions | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
change "true" and "false" to "availble" and "out of stock" | Excel Worksheet Functions | |||
HELP on "left","right","find","len","substitute" functions | Excel Discussion (Misc queries) | |||
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next | New Users to Excel |