Alex, I actually found a work around so I thought Id post what was going on incase anyone else runs into this problem.
I have a fairly large spreadsheet that has a bunch of validation dropdowns. Now whenever a new sheet is needed I use a macro to create the new sheet and apply all the validations.
As my spreadsheet grew this worked fine until I figured out that the range method has a 255 character limit. Now it took me a bit to figure this out, but to get around the 255 character limit you have to use a union to join your string into a variable then use the properties of the variable to apply the validations.
New Code Shortened Set R1 = Range("E13:AJ20,E22:AJ29,") Set R2 = Range("E160:AJ171,E176:AJ183")
Set RngAll = Application.Union(R1, R2)
'Key Range With RngAll.Validation .Delete .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _ xlBetween, Formula1:="=Keys!$A$2:$A$20" .IgnoreBlank = True .InCellDropdown = True .InputTitle = "" .ErrorTitle = "" .InputMessage = "" .ErrorMessage = "" .ShowInput = True .ShowError = True End With
Reply from Alex Hedley:
Thanks for sharing.
Sorry, only students may add comments.
Click here for more
information on how you can set up an account.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Excel Forum.
The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.