sharky12345
Well-known Member
- Joined
- Aug 5, 2010
- Messages
- 3,422
- Office Version
- 2016
- Platform
- Windows
I'm using this code to populate a Userform Listbox;
I'm getting an error which I don't understand - I get an error 1004, Application Defined or or object defined error with the following line highlighted;
The bizarre thing is if I change 'Not Due' to 'Not Duez' it works fine.
Can someone help me understand what the issue is?
VBA Code:
If ComboBox1.Value = "Not Due Staff" Then
Sheet2.Activate
CmdEdit.Enabled = False
CmdView.Enabled = False
CmdExpired.Enabled = False
Label15.Visible = True
Label16.Visible = True
Label16.Caption = "Last 121"
Label17.Visible = True
With Me.ListBox1
.ColumnCount = 14
.ColumnWidths = "120,0,0,0,0,0,0,0,0,0,65,0,0,60"
End With
LastRow = Range("A65536").End(xlUp).Row
Set rng = Range("A2:N" & LastRow)
ReDim Ray(1 To 14, 1 To rng.Count)
For Each Dn In rng
If Dn.Value = "Not Due" Then
c = c + 1
For Ac = 1 To 14
Ray(Ac, c) = Dn.Offset(, -(14 - Ac)).Text
Next Ac
End If
Next Dn
Me.ListBox1.Column = Ray
'Sheet4.Activate
End If
I'm getting an error which I don't understand - I get an error 1004, Application Defined or or object defined error with the following line highlighted;
VBA Code:
Ray(Ac, c) = Dn.Offset(, -(14 - Ac)).Text
The bizarre thing is if I change 'Not Due' to 'Not Duez' it works fine.
Can someone help me understand what the issue is?