Hello, I am somewhat new to Excel VBA so please pardon my ignorance.
I am trying to create a VBA script that iterates through all the cells in a worksheet, finds those that have data validation enabled, and replaces ONLY the text fields leaving all validation formulas, etc fields unchanged. The reason why I am doing this is because I am translating data validation title/message fields into another language but do not want to change validation settings as such.
The data validation text fields that I am modifying are:
Dim target as Range
Set target = Worksheets(Left(strAddress, InStr(strAddress, "!") - 1)).Range(Right(strAddress, Len(strAddress) - InStrRev(strAddress, "!")))
target.Validation.ErrorMessage = strErrorMessage
target.Validation.ErrorTitle = strErrorTitle
target.Validation.InputMessage = strInputMessage
target.Validation.InputTitle = strInputTitle
For some reason, if I execute the above I am getting application error 1004; if I replace the variables with a specific string (such as "TEST"), there is no error, and the text fields are set correctly... I am sure I am doing something wrong.
I'd appreciate any thoughts/comments. Thanks.
I am trying to create a VBA script that iterates through all the cells in a worksheet, finds those that have data validation enabled, and replaces ONLY the text fields leaving all validation formulas, etc fields unchanged. The reason why I am doing this is because I am translating data validation title/message fields into another language but do not want to change validation settings as such.
The data validation text fields that I am modifying are:
Dim target as Range
Set target = Worksheets(Left(strAddress, InStr(strAddress, "!") - 1)).Range(Right(strAddress, Len(strAddress) - InStrRev(strAddress, "!")))
target.Validation.ErrorMessage = strErrorMessage
target.Validation.ErrorTitle = strErrorTitle
target.Validation.InputMessage = strInputMessage
target.Validation.InputTitle = strInputTitle
For some reason, if I execute the above I am getting application error 1004; if I replace the variables with a specific string (such as "TEST"), there is no error, and the text fields are set correctly... I am sure I am doing something wrong.
I'd appreciate any thoughts/comments. Thanks.