ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Data Validation Error (https://www.excelbanter.com/excel-programming/416940-data-validation-error.html)

Risky Dave

Data Validation Error
 
Hi,

As part of the functionality of a workbook I'm developing, a macro adds a
new data line to a page. One of the cells is validated from a drop-down list:

' Risk Categorisation data validation

FormatRange = "j" & RiskCount + 5
Range(FormatRange).Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop,
Operator:= _
xlBetween,
Formula1:="="Assumption,Commercial,Communications, Corporate/Strategic,Dependency,Economic/financial/market,Environmental/Force
Majeure,Governance,Organisational management/human
factors,Political/societal,Quality,Requirements,Schedule,Security,Te chnical -
Operational,Technical - Infrastructure,Technical - Software,Testing,3rd Party
- Customer,3rd Party - Supplier"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With

When I run the macro that inserts new line it works perfectly, including the
data validation. However, after saving and exiting the workbook, when I
re-open it I get an error message:

"Excel found unreadable content <workbook name here do you want to recover
the contents of this workbook?"

This offers me a yes/no option. If I select yes, the workbook continues to
open but the validation is lost. This runs before a Workbook_Open function.

After the Workbook_Open function has completed, the following message is
displayed:

"Removed Featu Data validation from /xl/worksheets/sheet4.xml part"

This has a link to an error log that basically tells me that the validation
has been removed.

Can anyone tell me:
1) What is happening?
2) How do I fix it (I've only just added the validation values. Previously
I had a holding statement to the effect of "Insert validation values here"
which worked fine)

This is under Vista on XL '07 if that makes any difference.

TIA

Dave


All times are GMT +1. The time now is 01:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com