Hot answers tagged

13

You’ve already noted that this could be done better without macros, so I won’t belabour the point. I will note, though, that your goal—“to refresh [your] skills at writing good solid macros”—makes about as much sense as refreshing your skills at writing code on punch cards. You are exercising an archaic practice that is dying out, and is unwelcome in any ...


10

Well, I don't know if your code could be better or faster but the code could be a lot shorter by using some Linq-"magic". Your code could use some level of input-parameter-validation because the methods in question are public which means anybody who uses these methods can pass whatever he/she wants, even null which would blow each method and would ...


2

Observation This is a common one beginners do. And to be blunt I wish they would not do this. It would be much better to learn how to sue the system logging tools. Questions Are there any apparent issues with how I implemented the macro? I don't see any. But the way you have done it there are no advantages of using the macro over a normal inline function. ...


1

Don't put everything in a single function. That makes your code difficult to maintain and reuse, even by yourself. The ideal function size is so small that one can no longer reasonably extract further functions from it. In your code, each program is just one function, quite the opposite of the ideal. All resources should be handled with try-with-resources ...


1

just need to add another approach. You could use Substring and IndexOf to get the first and the last name without looping. The only loop that you need is on last name to camelCase it. Though, names that needed to be lowered case needs to be defined in an array or a switch statement when looping over the last name, that's if you need to add more precision on ...


1

This is how I wrote it: import openpyxl,sys if len(sys.argv)<1: sys.exit() elif len(sys.argv)>1: wb = openpyxl.load_workbook(sys.argv[3]) sheet = wb.active from openpyxl.utils import get_column_letter,column_index_from_string N=int(sys.argv[1]) M=int(sys.argv[2]) newSpreadSheet1={} for column in range(1,sheet....


Only top voted, non community-wiki answers of a minimum length are eligible