Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Restoring Line Numbers
Several of you have helped me in the past with code, for that I am very
grateful for all of your help. However, this VBA is still very hard for me to do on my own, with out a lot of help. Now if I could restore the line numbers to VBA, then I know that I could do my own coding, or can I by recording a Macro, see how to write a statement with the If€¦End if, I havent been able to figure that out as of yet. Is there a way to restore those annoying line numbers? Steve |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Restoring Line Numbers
Bump
"caldog" wrote: Several of you have helped me in the past with code, for that I am very grateful for all of your help. However, this VBA is still very hard for me to do on my own, with out a lot of help. Now if I could restore the line numbers to VBA, then I know that I could do my own coding, or can I by recording a Macro, see how to write a statement with the If€¦End if, I havent been able to figure that out as of yet. Is there a way to restore those annoying line numbers? Steve |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Restoring Line Numbers
Hi Steve
Do you mean line numbers in the VBE? To do this you would need a COM addin called MZTools. www.mztools.com. It is free and has a lot of other helpful features as well as line numbering your code. You can't record If statements but have a look in visual basic help. They are pretty well described. Hope this helps Rowan caldog wrote: Bump "caldog" wrote: Several of you have helped me in the past with code, for that I am very grateful for all of your help. However, this VBA is still very hard for me to do on my own, with out a lot of help. Now if I could restore the line numbers to VBA, then I know that I could do my own coding, or can I by recording a Macro, see how to write a statement with the If€¦End if, I havent been able to figure that out as of yet. Is there a way to restore those annoying line numbers? Steve |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Restoring Line Numbers
Thanks Rown for you reply, but I must be a complete idiot, becasue those
instructions, confuse me more then help me. O well Steve "Rowan Drummond" wrote: Hi Steve Do you mean line numbers in the VBE? To do this you would need a COM addin called MZTools. www.mztools.com. It is free and has a lot of other helpful features as well as line numbering your code. You can't record If statements but have a look in visual basic help. They are pretty well described. Hope this helps Rowan caldog wrote: Bump "caldog" wrote: Several of you have helped me in the past with code, for that I am very grateful for all of your help. However, this VBA is still very hard for me to do on my own, with out a lot of help. Now if I could restore the line numbers to VBA, then I know that I could do my own coding, or can I by recording a Macro, see how to write a statement with the If€¦End if, I havent been able to figure that out as of yet. Is there a way to restore those annoying line numbers? Steve |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Restoring Line Numbers
Hi Steve
It could just be me that is confused <g. What line numbers are you wanting to restore? Regards Rowan caldog wrote: Thanks Rown for you reply, but I must be a complete idiot, becasue those instructions, confuse me more then help me. O well Steve "Rowan Drummond" wrote: Hi Steve Do you mean line numbers in the VBE? To do this you would need a COM addin called MZTools. www.mztools.com. It is free and has a lot of other helpful features as well as line numbering your code. You can't record If statements but have a look in visual basic help. They are pretty well described. Hope this helps Rowan caldog wrote: Bump "caldog" wrote: Several of you have helped me in the past with code, for that I am very grateful for all of your help. However, this VBA is still very hard for me to do on my own, with out a lot of help. Now if I could restore the line numbers to VBA, then I know that I could do my own coding, or can I by recording a Macro, see how to write a statement with the If€¦End if, I havent been able to figure that out as of yet. Is there a way to restore those annoying line numbers? Steve |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Restoring Line Numbers
Hi Rown,
I'm working with a code that saves open workbooks. My problem is there is one workbook that I don't want to save, everytime I try to figure out to use a if statement, it just dosen't work. It is only looking at the one file I don't need to save. It is not even getting to the others at all. Now if programming the old fashion way by using line numbers in my code I know how to get around this problem. Example: 10 If A=1 then 20 Goto 50 30 Else 40 Save Activeworkbook.name ("insert workbook name here") 50 Endif My problem is step 20, I can't figure out to have system check all open workbooks, and save them all but one. Steve-the frustrated man "Rowan Drummond" wrote: Hi Steve It could just be me that is confused <g. What line numbers are you wanting to restore? Regards Rowan caldog wrote: Thanks Rown for you reply, but I must be a complete idiot, becasue those instructions, confuse me more then help me. O well Steve "Rowan Drummond" wrote: Hi Steve Do you mean line numbers in the VBE? To do this you would need a COM addin called MZTools. www.mztools.com. It is free and has a lot of other helpful features as well as line numbering your code. You can't record If statements but have a look in visual basic help. They are pretty well described. Hope this helps Rowan caldog wrote: Bump "caldog" wrote: Several of you have helped me in the past with code, for that I am very grateful for all of your help. However, this VBA is still very hard for me to do on my own, with out a lot of help. Now if I could restore the line numbers to VBA, then I know that I could do my own coding, or can I by recording a Macro, see how to write a statement with the If€¦End if, I havent been able to figure that out as of yet. Is there a way to restore those annoying line numbers? Steve |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Restoring Line Numbers
Using Goto statements is very poor coding practice and should not
be used. If I understand your question, you can use code like the following: Dim WB As Workbook For Each WB In Workbooks If WB.Name < "TheOneYouDoNotWantToSave.xls" Then WB.Save End If Next WB -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "caldog" wrote in message ... Hi Rown, I'm working with a code that saves open workbooks. My problem is there is one workbook that I don't want to save, everytime I try to figure out to use a if statement, it just dosen't work. It is only looking at the one file I don't need to save. It is not even getting to the others at all. Now if programming the old fashion way by using line numbers in my code I know how to get around this problem. Example: 10 If A=1 then 20 Goto 50 30 Else 40 Save Activeworkbook.name ("insert workbook name here") 50 Endif My problem is step 20, I can't figure out to have system check all open workbooks, and save them all but one. Steve-the frustrated man "Rowan Drummond" wrote: Hi Steve It could just be me that is confused <g. What line numbers are you wanting to restore? Regards Rowan caldog wrote: Thanks Rown for you reply, but I must be a complete idiot, becasue those instructions, confuse me more then help me. O well Steve "Rowan Drummond" wrote: Hi Steve Do you mean line numbers in the VBE? To do this you would need a COM addin called MZTools. www.mztools.com. It is free and has a lot of other helpful features as well as line numbering your code. You can't record If statements but have a look in visual basic help. They are pretty well described. Hope this helps Rowan caldog wrote: Bump "caldog" wrote: Several of you have helped me in the past with code, for that I am very grateful for all of your help. However, this VBA is still very hard for me to do on my own, with out a lot of help. Now if I could restore the line numbers to VBA, then I know that I could do my own coding, or can I by recording a Macro, see how to write a statement with the If.End if, I haven't been able to figure that out as of yet. Is there a way to restore those annoying line numbers? Steve |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Restoring Line Numbers
Chip thanks for the reply, but you see I'm a very old gentleman and that the
way I use t oprogram. Just now trying to get my hands around this VBA coding and it is very hard for me to get it. But reading your coding I think that I was forgetting a line, and you just help me out. Thanks again, Steve "Chip Pearson" wrote: Using Goto statements is very poor coding practice and should not be used. If I understand your question, you can use code like the following: Dim WB As Workbook For Each WB In Workbooks If WB.Name < "TheOneYouDoNotWantToSave.xls" Then WB.Save End If Next WB -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "caldog" wrote in message ... Hi Rown, I'm working with a code that saves open workbooks. My problem is there is one workbook that I don't want to save, everytime I try to figure out to use a if statement, it just dosen't work. It is only looking at the one file I don't need to save. It is not even getting to the others at all. Now if programming the old fashion way by using line numbers in my code I know how to get around this problem. Example: 10 If A=1 then 20 Goto 50 30 Else 40 Save Activeworkbook.name ("insert workbook name here") 50 Endif My problem is step 20, I can't figure out to have system check all open workbooks, and save them all but one. Steve-the frustrated man "Rowan Drummond" wrote: Hi Steve It could just be me that is confused <g. What line numbers are you wanting to restore? Regards Rowan caldog wrote: Thanks Rown for you reply, but I must be a complete idiot, becasue those instructions, confuse me more then help me. O well Steve "Rowan Drummond" wrote: Hi Steve Do you mean line numbers in the VBE? To do this you would need a COM addin called MZTools. www.mztools.com. It is free and has a lot of other helpful features as well as line numbering your code. You can't record If statements but have a look in visual basic help. They are pretty well described. Hope this helps Rowan caldog wrote: Bump "caldog" wrote: Several of you have helped me in the past with code, for that I am very grateful for all of your help. However, this VBA is still very hard for me to do on my own, with out a lot of help. Now if I could restore the line numbers to VBA, then I know that I could do my own coding, or can I by recording a Macro, see how to write a statement with the If.End if, I haven't been able to figure that out as of yet. Is there a way to restore those annoying line numbers? Steve |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Restoring Line Numbers
caldog wrote: Chip thanks for the reply, but you see I'm a very old gentleman and that the way I use t oprogram. Just now trying to get my hands around this VBA coding and it is very hard for me to get it. Hi, The code fragment you gave brought back memories of programming the TRS-80 (which my father bought when I was still a high-school student in the 70s). For years I got away from programming, until I started writing Excel macros about 5 years ago. I found Walkenbach's small book "Excel VBA for Dummies" a useful tool for making the transition from old-style Basic to new-style Basic. After I got through that I was ready to tackle more ambitious books. -John Coleman |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
Restoring Line Numbers
Hi John thanks for your reply.
I will go and get that book today. Steve "John Coleman" wrote: caldog wrote: Chip thanks for the reply, but you see I'm a very old gentleman and that the way I use t oprogram. Just now trying to get my hands around this VBA coding and it is very hard for me to get it. Hi, The code fragment you gave brought back memories of programming the TRS-80 (which my father bought when I was still a high-school student in the 70s). For years I got away from programming, until I started writing Excel macros about 5 years ago. I found Walkenbach's small book "Excel VBA for Dummies" a useful tool for making the transition from old-style Basic to new-style Basic. After I got through that I was ready to tackle more ambitious books. -John Coleman |
#11
Posted to microsoft.public.excel.programming
|
|||
|
|||
Restoring Line Numbers
Sub SaveBooks()
10 B = Application.Workbooks.Count 20 A = 1 30 Application.Workbooks(A).Activate 40 If UCase(ActiveWorkbook.Name) = "ABCD.XLS" _ Then GoTo 60 50 ActiveWorkbook.Save 60 A = A + 1 70 If A <= B Then GoTo 30 End Sub worked for me. -- Regards, Tom Ogilvy "caldog" wrote in message ... Hi Rown, I'm working with a code that saves open workbooks. My problem is there is one workbook that I don't want to save, everytime I try to figure out to use a if statement, it just dosen't work. It is only looking at the one file I don't need to save. It is not even getting to the others at all. Now if programming the old fashion way by using line numbers in my code I know how to get around this problem. Example: 10 If A=1 then 20 Goto 50 30 Else 40 Save Activeworkbook.name ("insert workbook name here") 50 Endif My problem is step 20, I can't figure out to have system check all open workbooks, and save them all but one. Steve-the frustrated man "Rowan Drummond" wrote: Hi Steve It could just be me that is confused <g. What line numbers are you wanting to restore? Regards Rowan caldog wrote: Thanks Rown for you reply, but I must be a complete idiot, becasue those instructions, confuse me more then help me. O well Steve "Rowan Drummond" wrote: Hi Steve Do you mean line numbers in the VBE? To do this you would need a COM addin called MZTools. www.mztools.com. It is free and has a lot of other helpful features as well as line numbering your code. You can't record If statements but have a look in visual basic help. They are pretty well described. Hope this helps Rowan caldog wrote: Bump "caldog" wrote: Several of you have helped me in the past with code, for that I am very grateful for all of your help. However, this VBA is still very hard for me to do on my own, with out a lot of help. Now if I could restore the line numbers to VBA, then I know that I could do my own coding, or can I by recording a Macro, see how to write a statement with the If.End if, I haven't been able to figure that out as of yet. Is there a way to restore those annoying line numbers? Steve |
#12
Posted to microsoft.public.excel.programming
|
|||
|
|||
Restoring Line Numbers
Thanks Tom what I was looking for in code. Also by looking at Chip's code,
the light finally came on, I was missing the for... next loop. Once I got that coded, everthing is working. Not perfect but usable. Thanks again for everybody's help. Steve "Tom Ogilvy" wrote: Sub SaveBooks() 10 B = Application.Workbooks.Count 20 A = 1 30 Application.Workbooks(A).Activate 40 If UCase(ActiveWorkbook.Name) = "ABCD.XLS" _ Then GoTo 60 50 ActiveWorkbook.Save 60 A = A + 1 70 If A <= B Then GoTo 30 End Sub worked for me. -- Regards, Tom Ogilvy "caldog" wrote in message ... Hi Rown, I'm working with a code that saves open workbooks. My problem is there is one workbook that I don't want to save, everytime I try to figure out to use a if statement, it just dosen't work. It is only looking at the one file I don't need to save. It is not even getting to the others at all. Now if programming the old fashion way by using line numbers in my code I know how to get around this problem. Example: 10 If A=1 then 20 Goto 50 30 Else 40 Save Activeworkbook.name ("insert workbook name here") 50 Endif My problem is step 20, I can't figure out to have system check all open workbooks, and save them all but one. Steve-the frustrated man "Rowan Drummond" wrote: Hi Steve It could just be me that is confused <g. What line numbers are you wanting to restore? Regards Rowan caldog wrote: Thanks Rown for you reply, but I must be a complete idiot, becasue those instructions, confuse me more then help me. O well Steve "Rowan Drummond" wrote: Hi Steve Do you mean line numbers in the VBE? To do this you would need a COM addin called MZTools. www.mztools.com. It is free and has a lot of other helpful features as well as line numbering your code. You can't record If statements but have a look in visual basic help. They are pretty well described. Hope this helps Rowan caldog wrote: Bump "caldog" wrote: Several of you have helped me in the past with code, for that I am very grateful for all of your help. However, this VBA is still very hard for me to do on my own, with out a lot of help. Now if I could restore the line numbers to VBA, then I know that I could do my own coding, or can I by recording a Macro, see how to write a statement with the If.End if, I haven't been able to figure that out as of yet. Is there a way to restore those annoying line numbers? Steve |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Restoring | Excel Discussion (Misc queries) | |||
Restoring Filter | Excel Discussion (Misc queries) | |||
Restoring toolbar | New Users to Excel | |||
Line numbers some numbers are blue some are black | Excel Discussion (Misc queries) | |||
Activating & Restoring | Excel Programming |