You can disable events in the BeforeSave event to prevent rerunning code when saving.
But your problem is more about your code corrupting the workbook at some point.
That corruption is cause by data validation list being over 255 characters long.
Public Function addDropDownStr(rng As Range, dropDownFormula As String) As String
Dim MyList As String
MyList = dropDownFormula
If Len(dropDownFormula) > 255 Then
MyList = Left(dropDownFormula, 255)
End If
With rng.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertInformation, Operator:= _
xlBetween, Formula1:=MyList
.InCellDropdown = True
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = "You have entered a value that is not predefined"
.ShowInput = True
.ShowError = False
colCounter = colCounter + 1
End With
End Function
You might want to use a sheet to store the list in a range and avoid that problem completely.
Bookmarks