写入单元格时Excel VBA错误1004

时间:2014-04-18 16:40:41

标签: excel vba excel-vba

我试图在excel表格的单元格中写字。 进行的方式如下:

Dim sh_work As Worksheet
Set sh_work = currFileCreated.Sheets(1)
sh_work.Cells(26, 4) = "bla bla bla"

除了列" DI"上的单元格外,这种方法非常有效。 我写的时候:

Dim sh_work As Worksheet
Set sh_work = currFileCreated.Sheets(1)
sh_work.Cells(15, 113) = "bla bla bla"

Dim sh_work As Worksheet
Set sh_work = currFileCreated.Sheets(1)
sh_work.Range("DI15") = "bla bla bla"

Dim sh_work As Worksheet
Set sh_work = currFileCreated.Sheets(1)
sh_work.Range("DI15").Value = "bla bla bla"

错误1004已启动

我到处寻找......但没有 有人可以告诉我一个解决方案吗?

1 个答案:

答案 0 :(得分:0)

如果取消保护工作表,它是否有效?

Dim sh_work As Worksheet
Set sh_work = currFileCreated.Sheets(1)
sh_work.unprotect
sh_work.Cells(15, 113) = "bla bla bla"
sh_work.protect