无法设置字体类的斜体属性 [英] Unable to to set the italic property of the font class

查看:63
本文介绍了无法设置字体类的斜体属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将此代码写在命令按钮下,工作表受到保护.命令按钮充当重置按钮,并从许多单元格中删除数据并更改字体属性.这是代码:我使用此按钮更改的范围已添加到异常

  Range("C10:c18")="Range("C20:c24")="Range("c5:c6")="_"Range("c11:c12")=可选"带范围("c11:c12")带有.Font.Italic = True'"Line 1".ColorIndex = 48'第2行"结束于结束于 

它抛出VBA错误:无法为第1行和第1行设置字体类的斜体属性.

第2行的应用程序定义或对象定义错误

It throws the VBA Error: Unable to to set the italic property of the font class for line 1 and

Application defined or object defined error for line 2

解决方案

You must allow formatting cells when protecting the sheet, or protect the sheet on Workbook_Open using the UserInterfaceOnly:=True argument, so that your code can work even on protected sheets (for most things, anyway).

这篇关于无法设置字体类的斜体属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆