本文转自: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. EntityFramework 更新表结构到数据库

    在程序包管理器控制台 1.执行:Enable-Migrations -Force  生成:Migrations 2 修改AutomaticMigrationsEnabled默认为false改为true ...

  2. Web基础开发最核心要解决的问题

    Web基础开发要解决的问题,往往也就是那些框架出现的目的 - 要解决问题. 1. 便捷的Db操作: 2. 高效的表单处理: 3. 灵活的Url路由: 4. 合理的代码组织结构: 5. 架构延伸 缓存. ...

  3. sso demo ( cas )

    1. generate keystore command : keytool -genkey -alias testtomcat -keyalg RSA -keystore "C:\User ...

  4. 机器学习实战 - 读书笔记(05) - Logistic回归

    解释 Logistic回归用于寻找最优化算法. 最优化算法可以解决最XX问题,比如如何在最短时间内从A点到达B点?如何投入最少工作量却获得最大的效益?如何设计发动机使得油耗最少而功率最大? 我们可以看 ...

  5. ThoughtWorks.QRCode生成二维码

    首先引用需要的dll,此处使用的是ThoughtWorks.QRCode.dll,网上可以找到对应的,此处也有一份,点击下载 http://files.cnblogs.com/files/ives/T ...

  6. H5实现的可自定义贪吃蛇游戏

    原创游戏,使用lufylegend.js开发 用canvas实现的贪吃蛇游戏,与一般的贪吃蛇游戏不同,图片经过美工设计,代码设计支持扩展和自定义. 游戏元素丰富,包括障碍物(仙人掌),金币(奖励),苹 ...

  7. JavaScript的作用域和闭包

    首发于:https://mingjiezhang.github.io/ 闭包和作用域有着千丝万缕的联系. js的作用域 具体的作用域我就不展开叙述了.其中很重要的两点就是:js的作用域链机制和函数词法 ...

  8. UniversalApp启动页面设置

    在新建的一个UniversalApp中,我在Shared项目下添加了一个页面,新建的页面名称为InitPage.xaml,现在我想把InitPage.xaml作为起始页,但是在配置文件中未找到设置启动 ...

  9. 同源策略 JSONP(实践篇)

    JSONP详解 json相信大家都用的多,jsonp我就一直没有机会用到,但也经常看到,只知道是“用来跨域的”,一直不知道具体是个什么东西.今天总算搞明白了.下面一步步来搞清楚jsonp是个什么玩意. ...

  10. 【读书笔记】iOS-Xcode-模拟器操作的一些快捷键

    Cmd+1/2/3       可以切换模拟器的显示比例. Option+Shift     可以在模拟器中调出双指拖动效果. Option      可以在模拟器中调出双指放大缩小效果. Comma ...