对象不支持此属性或方法?

时间:2013-09-30 01:57:04

标签: excel vba

我正在尝试将字母成绩输入excel,但是当我输入成绩时,它会出现“错误428,对象不支持此属性或方法。”我做错了什么?

Option Explicit
Sub HW09()

Dim ng As Integer
Dim v As String

Do

ng = InputBox("Please enter the student's numerical grade.")
    If ng < 0 Then
        ng = 0
    ElseIf ng > 100 Then
        ng = 100
    Else
End If


Cells(c, 2).Value (ng)
c = c + 1

v = InputBox("Would you like to enter another grade? Type 'Y' for yes and 'N' for no.")
    If v = "N" Then Exit Do

Loop

1 个答案:

答案 0 :(得分:2)

应该是

Cells(c, 2).Value = ng

如果输入 A,B,C 等字母,则应该会出现类型不匹配错误

另外,我没有看到c

的任何初始化