Layer control with a macro

I am new to this macro writing and so do not know much, but I would like to be able to write a macro that controls the on and off control of layers based upon custom properties in the design table that is brought into the drawing.

Is this possible or is it to much to ask in one macro?

SolidworksDrawings And Detailing