【发布时间】:2025-11-27 14:55:02
【问题描述】:
我正在尝试在 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
【问题讨论】:
-
@sam092 有答案。我注意到这个in your previous question 并确保我的回答避免了这个错误。此外,您可以简单地做:
If MsgBox("Would you like to enter another grade?", vbYesNo) = vbNo Then Exit Do而不是依赖InputBox和笨重的字母/字符串用户输入:)