Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 Dim vrtCustomerLocation2 As Variant vrtSheetName = ActiveSheet.Name If ActiveCell.Row = 6 Then With Worksheets("Customers & Jobs") If Cells(7, ActiveCell.Column).Value = "Extra" Then vrtCustomerName = Worksheets("Customers & Jobs").Cells(7, ActiveCell.Column - 1).Value Worksheets("Customers & Jobs").Visible = True Set vrtCustomerLocation = Range("Customers").Find(What:=vrtCustomerName, LookIn:=xlValues) vrtJobValue = Cells(Range(vrtCustomerLocation).Row, 5).Value vrtValidationValue = vrtJobValue vrtOriginalLocation = vrtCustomerLocation MsgBox Prompt:=vrtCustomerLocation If Not vrtCustomerLocation = Empty Then vrtFirstAddress = vrtOriginalLocation Do vrtCustomerLocation = .FindNext(vrtFirstAddress) vrtJobValue = .Cells(Range(vrtCustomerLocation).Row, 5).Value vrtValidationValueOld = vrtValidationValue vrtValidationValue = vrtValidationValueOld & "," & vrtJobValue Loop While vrtCustomerLocation < vrtFirstAddress And Not vrtJobValue = Empty With Worksheets(vrtSheetName).Range(ActiveCell.Address) .Validation .Delete .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:=vrtValidationValue End With End If 'Worksheets("Customers & Jobs").Visible = False End If End With End If In the code above I'm trying to lookup a address, store it in a variable, and then take data off of an inactive sheet and insert it into a dropdown list using data validation. Any help is appreciated |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Runtime 1004 error -- insert method of range class failed. | Excel Discussion (Misc queries) | |||
runtime error 1004 method range of object '_global failed | Excel Discussion (Misc queries) | |||
runtime error '1004' delete Method of Range Class Failed | Excel Programming | |||
runtime error '1004' delete Method of Range Class Failed | Excel Programming | |||
excel97: runtime error 1004 select method of range class failed | Excel Programming |