Hi All,
I'm quite new to VBA myself and a bit stuck on the following code.
The code itself is supposed to check a name group on sheet 7. If this contains the value "3rd" this should add the group "third" to the listbox on the userform. I've currently got this on the code of the userform itself but I'm getting the error: "Object variable or with block variable not set"
The code interfering is the bold code below.
Any advice is much appreciated!
I'm quite new to VBA myself and a bit stuck on the following code.
The code itself is supposed to check a name group on sheet 7. If this contains the value "3rd" this should add the group "third" to the listbox on the userform. I've currently got this on the code of the userform itself but I'm getting the error: "Object variable or with block variable not set"
The code interfering is the bold code below.
Code:
Private Sub Issueform_Click()
Dim Fault As String
Dim Service As String
[B]Dim departmentlist As Object[/B]
Fault = "False"
Service = "False"
If Sheet7.Range("fors").Value = "Fault" Then Fault = "True"
If Sheet7.Range("fors").Value = "Service Request" Then Service = "True"
[B]If Sheet7.Range("floor").Value = "3rd" Then departmentlist.RowSource = Sheet7.Range("third").Text[/B]
With Infoform
.StartUpPosition = 0
.Left = Application.Left + (0.5 * Application.Width) - (0.5 * .Width)
.Top = Application.Top + (0.5 * Application.Height) - (0.5 * .Height)
.namebox.Text = Sheet7.Range("Name").Value
.windowsusernamebox.Text = Sheet7.Range("username").Value
.systemdropdown.Text = Sheet7.Range("system").Value
.faultoption.Value = Fault
.serviceoption.Value = Service
.Affectednumber.Text = Sheet7.Range("people")
.ST1.Text = Sheet7.Range("servicetag1")
.ST2.Text = Sheet7.Range("servicetag2")
.ST3.Text = Sheet7.Range("servicetag3")
.issue.Text = Sheet7.Range("description")
.Show
End With
End Sub
Any advice is much appreciated!