在Excel中隐藏字符,我得到错误:无法设置Range类的NumberFormat属性
我只想让我的cells
只显示最后100个字符。
这是我的代码:
Sub HideCharacters() Dim DQ As String, mesage As String On Error GoTo Errorcatch DQ = Chr(34) For Each r In Selection mesage = Right(r.Value, 100) mesage = DQ & mesage & DQ r.NumberFormat = ";;;" & mesage Next r Errorcatch: MsgBox Err.Description End Sub
代码工作了一段时间,然后当我添加更多的工作表,并将macros应用于他们,我开始得到错误:“ Unable to set the NumberFormat property of the Range class
”,我该如何解决这个问题?
预先感谢您,-Matt
从:
工作簿中的数字格式
在200和250之间,取决于您安装的Excel的语言版本
在我的Excel 2010中,第207个格式失败:
Sub Tester() Dim c As Range For Each c In Range("A1:A1000") c.NumberFormat = ";;;""" & c.Address(False, False) & """" Next c End Sub