We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Locking a cell based on the value in the adjacent cell-Urgent


One of our requirement is to lock the cell if there is no value in the next cell in the same row.

For example
Cells A B C D
Row1 0 1

Here B1 is a readOnly/Locked cell and B1 value is set through a VLookUp formula.

We have to make
1. Cell A1 read only if Cell B1 has value 0 or Blank.
2. Display error message if A1.Value > B1.value.

This we have to apply in all the rows.

We have tried to write a VBA code using Taget.Cells.Next.Value to get B1 value. But unfortunately Taget.Cells.Next is pointing to the C1 cell ( ignoring B1 locked cell) instead.

Please suggest if there is any solution using ASPOSE to implement this scenario.

Best Regards,



I am not sure how could you do this using MS Excel features (i.e…, Protecting Worksheets, Data Validation, Conditional formatting etc.) and without using vba codes/ macros. For your information, Aspose.Cells does not support to create, manipulate or run macros or vba codes in the spreadsheets. I think your second point can be implemented via Data Validation feature (see the document for your reference: http://www.aspose.com/docs/display/cellsnet/Data+Filtering+and+Validation#DataFilteringandValidation-validation) And, if you could accomplish your entire task in MS Excel manually, please save an Excel file with it and post us here, we will check on how to do it via Aspose.Cells APIs.

Thank you.