PDA

View Full Version : Does anyone else have this error 1004?



jrsilverio
11-05-2022, 02:51 PM
30309

Does anyone else have this error 1004? I think it must have been a problem with the new windows update.


Application or object definition error

June7
11-05-2022, 04:36 PM
What is the exact error message? What is the procedure? Your code uses non-English so I can't run it.

Aussiebear
11-05-2022, 07:57 PM
As June7 has indicated, we need to know the exact error message. Just saying you have an error 1004 message isn't enough as there are a number of potential causes;

a) Method of Range of Object-Global failure,
b) Using a name that already in use,
c) Mis-spelling an Range objects name,
d) Range Object's selection failure,
e) Range Object's Activation failure,
f) Range Object's inability to be found.

jrsilverio
11-06-2022, 05:56 AM
As June7 has indicated, we need to know the exact error message. Just saying you have an error 1004 message isn't enough as there are a number of potential causes;

a) Method of Range of Object-Global failure,
b) Using a name that already in use,
c) Mis-spelling an Range objects name,
d) Range Object's selection failure,
e) Range Object's Activation failure,
f) Range Object's inability to be found.


@june7


For some unknown reason, this code started to give a problem, when I remove it, the other operations work, when I put it, it gives the error. Does it have something to do with the naming of the worksheet?

IMG: https://ibb.co/4frCL1Q



Dim mySheets, myControls, sht, uniqueListDim ncell As Long
Set mySheets = Sheets(Array("Plan2"))
myControls = Array(ComboBox4)
i = LBound(myControls)
For Each sht In mySheets
With sht
myControls(i).List = Application.Unique(.Range("A1:A" & .Cells(.Rows.Count, "A").End(xlUp).Row))
i = i + 1
End With
Next

the funny thing is that this one doesn't show errors, it just makes another function in my vba


'assumes there's more than one instance of a name in column A:Dim tf()
With Sheets("Plan2")
ncell = .Cells(.Rows.Count, "D").End(xlUp).Row
ReDim tf(1 To ncell, 1 To 1)
bb = ComboBox8.Value
nn = .Range("D1:D" & ncell)
For i = 1 To ncell
tf(i, 1) = nn(i, 1) = bb
Next i
ComboBox9.List = Application.WorksheetFunction.Filter(.Range("D1:D" & ncell), tf, "nothing found")
End With
'ComboBox9.ListIndex = 0' sets value to first value in list

June7
11-06-2022, 09:12 AM
You still have not provided the error message.

Could provide workbook for analysis.

snb
11-06-2022, 10:51 AM
Do not use excelfunctions in VBA.
VBA contains better alternatives.