title: Update an Excel style in VBA
body: <p>My Excel macro reads the answers to a survey from a set of Excel files. The answers of a survey contain a score (from 1 to 4) and a description. The goal is to generate a a matrix. Each cell of the matrix has a color that represents the score. I would like the user to be able to modify the layout of these cell. To make it easy to the user, I created a template matrix and a button. The user should be able to modify the layout of the cells and on a click of a button, a set of styles (Score 1, Score 2,...) should be generated. Once the matrix is created, the Workbook should be to function without the survey files.</p>
  <p>I have tried a couple of things:</p>
  <p><strong>Try 1</strong></p>
  <pre><code>ThisWorkbook.Styles.Add &quot;Score 1&quot;, BasedOn:=cell1
  </code></pre>
  <p>This gives errors. I don't fully understand when they occur, but one of the causes is when the user modifies the cell layout by selecting another style.</p>
  <p><strong>Try 2</strong></p>
  <pre><code>ThisWorkbook.Styles(&quot;Score 1&quot;).Delete
  ThisWorkbook.Styles.Add &quot;Score 1&quot;, BasedOn:=cell1
  </code></pre>
  <p>This is not a good idea: all cells loose their styling when it is executed a second time.</p>
  <p><strong>Try 3: Current</strong></p>
  <p>Copy the most frequently used properties of the cells layout and copy them to the style. If this style is deleted by the user, it is recreated. This procedures is not ideal, since most style properties won't be covered.</p>
  <p>Is there a way to update a cell style that is more general? I would like there to be as little room as possible to make the workbook in an inconsistent and non-functional state.</p>