I'm just feeling my way around here, having had a post recently moved over from another site together with its question. While I like the idea of a place to ask specifically for improvements to working code, I also see the potential for a lazy coder to 'code dump' something like a rat's nest of recorded MS Office VBA in the hopes of getting someone to clean it up.
What are the expectations of an answer to a situation like that? Are rewrites to one or two blocked sections that address different methods sufficient to meet site standards of a quality answer or should larger or even complete rewrites be provided?
My viewpoint is generally to help the user(s) help themselves, not do their work for them. If I rewrite something like this:
Sheets("Sheet1").Select Range("A1").Select Selection.Copy Sheets("Sheet2").Select Range("B8").Select ActiveWindow.SmallScroll Down:=-45 ActiveWindow.LargeScroll ToRight:=-1 Range("A1").Select ActiveSheet.Paste Sheets("Sheet1").Select Range("A2").Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet2").Select Range("A2").Select ActiveSheet.Paste Sheets("Sheet1").Select (etc., etc., etc. ...)
To something like,
With Sheets("Sheet1") .Range("A1").Copy Destination:=Sheets("Sheet2").Range("A1") (you can follow this method for all of the others) End With
Is this a satisfactory rewrite that meets site standards? Granted, if the recorded code also included something like a
.Sort operation then that should be addressed as well if an improvement could be offered.
Hmmm... might need a tag specifically for Site Standards; especially during the weaning period.