ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run-time Error '1004' Unable to get the findnext property... (https://www.excelbanter.com/excel-programming/303837-re-run-time-error-1004-unable-get-findnext-property.html)

Tom Ogilvy

Run-time Error '1004' Unable to get the findnext property...
 
Your passing a string to FindNext as an argument and you should be passing a
range reference is one possible cause.

--
Regards,
Tom Ogilvy

"Sworkhard" wrote in message
...
What causes Run-time Error '1004' Unable to get the FindNext property of

the Range class

The code that causes it is:
Dim vrtSheetName As Variant
Dim vrtJobValue, vrtCustomerLocation As Variant
Dim vrtCustomerName, vrtValidationValue As Variant
Dim vrtOriginalLocation, vrtFirstAddress As Variant
Dim vrtValidationValueOld As Variant
Dim Msg, ans As Variant

vrtSheetName = ActiveSheet.Name

If ActiveCell.Row = 6 Then

With Worksheets("Customers & Jobs")

If Cells(7, ActiveCell.Column).Value = "Extra" Then

If ActiveCell.Value = "" Then Exit Sub

vrtCustomerName = Worksheets(vrtSheetName).Cells(6,

ActiveCell.Column - 1).Value

Worksheets("Customers & Jobs").Visible = True

Set vrtCustomerLocation =

Range("Customers").Find(What:=vrtCustomerName, LookIn:=xlValues)
vrtJobValue =

..Cells(Range(vrtCustomerLocation.Address).Row, 5).Value
vrtValidationValue = vrtJobValue
vrtOriginalLocation = vrtCustomerLocation.Address

Do

vrtCustomerLocation =

Range("Customers").FindNext(vrtOriginalLocation)
vrtJobValue = Empty
Set vrtJobValue =

..Cells(Range(vrtCustomerLocation).Row, 5).Value

If Not vrtJobValue = Empty Then
vrtValidationValueOld = vrtValidationValue
vrtValidationValue = vrtValidationValueOld

& "," & vrtJobValue
End If

Loop While vrtCustomerLocation < vrtFirstAddress

And Not vrtJobValue = Empty

With

Worksheets(vrtSheetName).Range(ActiveCell.Address)

.Validation.Delete
.Validation.Add Type:=xlValidateList,

AlertStyle:=xlValidAlertStop, Operator:=xlBetween,
Formula1:=vrtValidationValue

End With

Worksheets("Customers & Jobs").Visible = False
Application.ScreenUpdating = True
End If
End With
End If





All times are GMT +1. The time now is 04:33 PM.

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