i have this procedure and works fine, what i do is make a validation list from a range of anothe sheet.
i = 4
list = ""
Do While Not Sheets("Sheet2"
.Cells(i, 1) = ""
If i <> 4 Then lista = lista & ","
lista = lista & Sheets("sheet2"
.Cells(i, 1)
i = i + 1
Loop
With Target.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:=lista
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = "Error"
.ShowInput = True
.ShowError = True
End With
the problem is the following, when len(list)>255 i get the following error
Run-time error'-2147417848(80010108)'
Method 'Add'of object 'Validation'failed'
and guess what? when you end this process and try to quit excel ( 2002 my case ) Cannot quit Microsoft Excel. i have to end the excel.exe process.
Is the a way i could use a more that 255 chars validation list?
thankx
lovalles
i = 4
list = ""
Do While Not Sheets("Sheet2"
If i <> 4 Then lista = lista & ","
lista = lista & Sheets("sheet2"
i = i + 1
Loop
With Target.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:=lista
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = "Error"
.ShowInput = True
.ShowError = True
End With
the problem is the following, when len(list)>255 i get the following error
Run-time error'-2147417848(80010108)'
Method 'Add'of object 'Validation'failed'
and guess what? when you end this process and try to quit excel ( 2002 my case ) Cannot quit Microsoft Excel. i have to end the excel.exe process.
Is the a way i could use a more that 255 chars validation list?
thankx
lovalles