Document Solutions for Excel, Java Edition | Document Solutions
Features / Data Validations / Modify Validation
In This Topic
    Modify Validation
    In This Topic

    You can modify the validation rule for a cell range by using either of the two ways described below:

    Refer to the following example code to know how you can modify an existing validation rule applied to a cell or a range of cells in a worksheet.

    Copy Code
    Calendar time1 = new GregorianCalendar(1899, 11, 30, 13, 30, 0);
    Calendar time2 = new GregorianCalendar(1899, 11, 30, 18, 30, 0);
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("hh:mm:ss");
    // Add Validation
    worksheet.getRange("A1:A2").getValidation().add(ValidationType.Date, ValidationAlertStyle.Stop,
            ValidationOperator.Between, simpleDateFormat.format(time1.getTime()),
    // Modify validation.