My excel sheet creates a map with various layers, showing a network made up of lines, squares, dots, and triangles. I have functions for each creation which take arguments such as
cellLocation As Range '(takes a given cell location)
shapeType As String '(oval, triangle, rectangle)
Color '(red, black, whatever)
sizeFactor As Double '(factors the shape size as a function of cell's width)
I am just learning about classes now, but wondering if classes would be useful in this case, and how I could use them to simplify my code, rather than having functions with 6 different arguments and such.
Originally I had functions like this:
Function CreateWell(cellRng As Range, wellName As String)
'creates a square of particular color, size, etc in the cellRng and names it wellName
Function CreateCompressor(cellRng As Range, compName As String)
'creates an oval of particular color, size , etc. similar to other func.
Then, because I had about 5 of these where the only variations were color, size, shape, etc. I tried making an overall function:
Function CreateShape(cellRng As Range, shpName As String, _
shpColor As String, shpSize as double, shpType As string)
But this seems to be messy (too many arguments). How can employing classes clean up this type of code?