本文转自:http://stackoverflow.com/questions/11953214/excel-how-to-lock-cell-without-using-macros-if-possible

You can prevent a user entering new data using only Data Validation

EDIT: use formula in list

Thanks to Head of Catering's comment, it is worth remembering that you can use formulas with Data Validation / List.

See his answer to another thread to see this in action: http://stackoverflow.com/a/11902463/138938

Original post

Walkthrough for Excel 2007:

  • Ribbon > Data > Data Validation
  • Authorize : Personnalized (or similar, my Excel is not in English sorry)
  • Enter this formula in the field:
    • =IF(A1="",FALSE,TRUE)

Thus, you cannot enter a value in the cell if A1 is still empty

Got it to work, but you can only actually set the value when it works out to a dropdown

I used Name Manager to set the name test to the value =IF(Sheet1!$A$1=1,"",Sheet1!$E$1:$E$5)

this means that if A1 is 1, I get nothing, and if A1 is anything else I get E1:E5

Then I set the data validation to List, with source to =test you can only set the value when test returns a list

When I do this, when A1 is 1, I get an empty list in my validation dropdown, and I can't change the value. If A1 is not 1, I get my list of E1:E5, and I can change the value

[转]Excel - How to lock cell without using macros if possible的更多相关文章

  1. Java的poi技术遍历Excel时进行空Cell,空row,判断

    /** * 导入信息 */ @Override public List<Object> add(HttpServletRequest request) { // TODO Auto-gen ...

  2. Java poi读取,写入Excel,处理row和cell可能为空的情况

    首先需要导入包 import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.poifs.filesystem.NP ...

  3. 用 Excel 测试“绘制两点间连线”的算法

    最近在研究和制作数字示波器,其中涉及一个小算法:需要将 ADC 采样的数值在 TFT LCD 屏幕上面显示并且用“线”连接起来. ADC 按照时序对输入电压采样后,记录的是一个个的数值,如果显示的时候 ...

  4. Openxml入门---Openxm读取Excel数据

    Openxml读取Excel数据: 有些问题,如果当Cell 里面是 日期和浮点型的话,对应的Cell.DataType==Null,对应的时间会转换为一个浮点型,对于这块可以通过DateTime.F ...

  5. SoapUI Pro Project Solution Collection-DataSource(jdbc,excel)

    here give a solution for excel file change the excel configuration these: Set Excel file path in cur ...

  6. Ruby操作Excel的方法与技巧大全

    测试工作中,批量的数据通常会放到excel表格中,测试输出的数据写回表格中,这样输入输出易于管理,同时清晰明了 使用ruby来操作excel文件首先需要在脚本里包含以下语句 require'win32 ...

  7. 使用POI来实现对Excel的读写操作

    事实上我感觉直接贴代码就好了.代码里面差点儿做到每一行一个凝视.应该看起来会比較简单 代码托管在github上:https://github.com/chsj1/ExcelUtils package ...

  8. 写20万数据到Excel只需9秒

    on my god,写20万数据到Excel只需9秒   还是菜鸟时,在某个.Net项目中,用户需要从业务系统导出Report,而数据量通常都在上万条以上,最初采用的方式就是在服务器端用NPOI生成E ...

  9. 通过Excel认识POI

    1.POI是什么 Apache POI - the Java API for Microsoft Documents,顾名思义,Apache的三方包,用来操作微软office文档的,多数时候用来操作e ...

随机推荐

  1. bootstrap布局 网格系统

    Bootstrap 网格系统 本章节我们将讲解 Bootstrap 的网格系统(Grid System). Bootstrap 提供了一套响应式.移动设备优先的流式网格系统,随着屏幕或视口(viewp ...

  2. C#从服务器下载文件到客户端源码

    1.在window窗体加个button控件,双击进去

  3. CRC16校验码生成

    /// <summary> /// 计算CRC-16 /// </summary> /// <param name="data"></pa ...

  4. ViewPager的使用

    在上培训课的时候,老师一直在将ViewPager是现在的主流,一直想去好好的了解一下,今天去网上学习了一下   ,做一个总结: ViewPager其实就是后来谷歌提供给我们的一个组件,就像TextVi ...

  5. EffectiveJava——复合优先于继承

    继承时实现代码重用的重要手段,但它并非永远是完成这项工作的最佳工具,不恰当的使用会导致程序变得很脆弱,当然,在同一个程序员的控制下,使用继承会变的非常安全.想到了很有名的一句话,你永远不知道你的用户是 ...

  6. js注入,黑客之路必备!

    最近刚出了新闻,阿里四名网络安全部门员工利用网页漏洞写js脚本抢月饼,于是兴致来了,想了解一下这个js脚本到底怎么写,各种刷单各种抢枪抢又是怎么实现的. 什么是javascript注入攻击? 1.每当 ...

  7. JavaScript中的null与nudefined

    null和undefined 概述 null与undefined都可以表示"没有",含义非常相似.将一个变量赋值为undefined或null,老实说,语法效果几乎没区别. var ...

  8. 原生js实现tab选项卡

    1.html部分 <body>        <div id="tab">            <div class="tab_menu& ...

  9. SAP debug的几种方式

         1. 直接在程序中设断点 这种方式想必大家都知道了,在se38里面打上breakpoint,程序运行到该处即进入debug模式   2.background Job的debug 进入SM37 ...

  10. Add a file to a Document Library and update metadata properties in a single method添加文档的方法

    private void AddFileToDocumentLibrary(string documentLibraryUrl, string filename, byte[] file_bytes, ...