excel vba中的运行时错误1004

excel vba中的运行时错误1004,vba,excel,Vba,Excel,我是vba新手,不知道如何解决这个问题- 运行时错误1004 调试时发现num值为空。我想在代码的行中获取num值,Sheet1.Range(“C”&num&“:C18”) 更改此项: month = Worksheet(2).Cells(31, "J") 为此: month = Worksheet(2).Cells(31, "J").Value 这是: Sheet1.Range("C" & num & ":C18") = 34 为此: For Each c in Work

我是vba新手,不知道如何解决这个问题-

运行时错误1004

调试时发现num值为空。我想在代码的行中获取num值,
Sheet1.Range(“C”&num&“:C18”)

更改此项:

month = Worksheet(2).Cells(31, "J")
为此:

month = Worksheet(2).Cells(31, "J").Value
这是:

Sheet1.Range("C" & num & ":C18") = 34
为此:

For Each c in Worksheet(1).Range("C" & num & ":C18") 
 c.Value = 34
Next c
For Each c in Worksheet(1).Range("C" & num & ":C18") 
 c.Value = 34
Next c