ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem with assigning values to items in collection (https://www.excelbanter.com/excel-programming/298092-problem-assigning-values-items-collection.html)

Jurry[_12_]

Problem with assigning values to items in collection
 
I get "error 424" (object needed) when assigning values to items in
collection (see the red code). What do I wrong???

Thx, Jurry
--------------------------
' In a standard module
Public Sub test()
Dim l As Long
Dim w As New wrdWord
l = 9
w.value = l
End Sub

----------------------------
' In a class module!
Public bit As New Collection

Private Sub Class_Initialize()
Dim i%
For i = 0 To 15
bit.Add False
Next i
End Sub

Property Let value(ByVal newValue As Long)
Dim i%
For i = 15 To 0 Step -1
If newValue - 2 ^ i = 0 Then
bit(i + 1) = True
newValue = newValue - 2 ^ i
Else
bit(i + 1) = False
End If
Next i
End Propert

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 11:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com