Error-91 VB script error
Error-91 VB script error
I keep getting error91 come up when I run my code which says that the object variable is not set.
It highlights the line:
'If OptionButton3.Value Then' when I try the debugger. I don't understand where its going wrong and I don't know what an object variable is? Has anyone else had this issue?
Any help would be much appreciated. Thank you
Sub NewEntry()
Dim cboOpName As Object
Dim TextBox1 As Object
Dim Operator As String
Dim UserForm1 As Object
Dim OptionButton1 As Object
Dim OptionButton3 As Object
Dim OptionButton11 As Object
Sheets("Sheet1").Activate
txtTitle1 = "Input Operator"
firstline1 = "Operator" & Chr(10) & Chr(10)
firstline = (firstline1)
Oper = InputBox(firstline, txtTitle1)
If Oper = "" Then
Exit Sub
Else
End If
If Oper = 0 Then
Exit Sub
Else
End If
txtTitle1 = "Input Project ID Number"
firstline3 = "Project ID No" & Chr(10) & Chr(10)
firstline = (firstline3)
PROno = InputBox(firstline, txtTitle1)
If PROno = "" Then
Exit Sub
Else
End If
If PROno = 0 Then
Exit Sub
Else
End If
txtTitle1 = "Input Date of Manufacture"
firstline3 = "Date of Manufacture" & Chr(10) & Chr(10)
firstline = (firstline3)
val1 = "DD/MM/YY"
DateM = InputBox(firstline, txtTitle1, val1)
If DateM = "" Then
Exit Sub
Else
End If
If DateM = 0 Then
Exit Sub
Else
End If
txtTitle1 = "Input Serial Number"
firstline3 = "Serial Number" & Chr(10) & Chr(10)
firstline = (firstline3)
SerNo = InputBox(firstline, txtTitle1)
If SerNo = "" Then
Exit Sub
Else
End If
If SerNo = 0 Then
Exit Sub
Else
End If
txtTitle1 = "Input Actuator ID"
firstline3 = "Actuator ID" & Chr(10) & Chr(10)
firstline = (firstline3)
ActID = InputBox(firstline, txtTitle1)
If ActID = "" Then
Exit Sub
Else
End If
If ActID = 0 Then
Exit Sub
Else
End If
txtTitle1 = "Input Opening Angle"
firstline3 = "Opening Angle" & Chr(10) & Chr(10)
firstline = (firstline3)
Angle = InputBox(firstline, txtTitle1)
If Angle = "" Then
Exit Sub
Else
End If
If Angle = 0 Then
Exit Sub
Else
End If
txtTitle1 = "Input Date of Test"
firstline3 = "Date of Test" & Chr(10) & Chr(10)
firstline = (firstline3)
DateT = InputBox(firstline, txtTitle1, val1)
val1 = "DD/MM/YY"
If DateT = "" Then
Exit Sub
Else
End If
If DateT = 0 Then
Exit Sub
Else
End If
UserForm2.Show
UserForm4.Show
Sheets("Sheet1").Activate
RowNow = 6
RowNum = 1
Do While RowNow = ""
If RowNow <> "" Then
RowNow = RowNow + 1
RowNum = RowNum + 1
Else
Cells(RowNow, 1).Value = RowNum
Cells(RowNow, 4).Value = PROno
Cells(RowNow, 9).Value = DateM
Cells(RowNow, 7).Value = SerNo
Cells(RowNow, 8).Value = ActID
Cells(RowNo, 2).Value = DateT
Cells(RowNow, 3).Value = Oper
Cells(RowNow, 10).Value = Angle
End If
Loop
Do While Cells(RowNow, 11) = ""
If OptionButton3.Value Then
Cells(RowNow, 11).Value = "Yes"
End If
Cells(RowNow, 11).Value = "No"
RowNow = RowNow + 1
Loop
Do While Cells(RowNow, 6) = ""
If OptionButton11.Value Then
Cells(RowNow, 6).Value = "Yes"
End If
Cells(RowNow, 6).Value = "No"
RowNow = RowNow + 1
Loop
Do While Cells(RowNow, 5) = ""
If OptionButton1.Value Then
Cells(RowNow, 5).Value = "Yes"
End If
Cells(RowNow, 5).Value = "No"
RowNow = RowNow + 1
Loop
End Sub
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Please read the description of a tag before adding it to your question. The description for the VB.NET tag EXPLICITLY states that it should not be used VB6, VBA or VBScript questions. It doesn't get any clearer than that.
– jmcilhinney
Jun 29 at 10:37