Skip to content

implement cptAddRange() #492

@AronGahagan

Description

@AronGahagan

The following method of collecting a series of ranges in order to apply formatting/style once should be optimzed.

'instead of this which appears everywhere:
If rExistingRange Is Nothing Then
    Set rExistingRange = oAddThisRange
Else
    Set rExistingRange = oWorksheet.Application.Union(rExistingRange, oAddThisRange)
End If
'[...]
If Len(rExistingRange.Address) > 200 Then
   oDict.Add rExistingRange, rExistingRange
    Set rExistingRangeRange = Nothing
End if
'[...]
'later: loop through each range in the dictionary and .Style = xlWhatever

use this instead:

'new sub/function in cptCore_bas so it's available everywhere
Public Sub cptAddRange(ByRef oExistingRange As Excel.Range, ByRef oAddThisRange As Excel.Range)
    'put existing logic (which is repeated everywhere) here, once
End Sub
'replace existing lines with simply
cptAddRange oExistingRange, oAddThisRange

exists in:

  • Status/cptStatusSheet_bas.bas:34
  • Metrics/cptDECM_bas.bas:16 [removed - not necessary]
  • Status/cptStatusSheetImport_bas.bas:1

Todo:

  • assign this issue
  • label the issue for enhancement or bug
  • label the issue with codemodule (so fixes can be aggregated and hotfixed together)
  • checkout appropriate branch and create topic branch
  • design, code and test
  • update codemodule <cpt_version>x.y.z</cpt_version>
  • update CurrentVersions.xml manually
  • commit changes prefix comment with Issue #XXX -
  • merge topic into appropriate branch(es) and push
  • delete topic branch

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions