是否有可能在Excelvalidation下拉框中增加256个字符的限制?

我正在dynamic创buildvalidation,并已达到256个字符的限制。 我的validation看起来像这样:

Level 1, Level 2, Level 3, Level 4..... 

有没有办法避开字符限制,然后指向一个范围?

validation已经在VBA中生成。 增加限制是避免对工作表当前工作方式产生影响的最简单方法。

我很确定这个256字符的限制没有办法,Joel Spolsky解释了为什么在这里: http : //www.joelonsoftware.com/printerFriendly/articles/fog0000000319.html 。

但是,您可以使用VBA通过编写Worksheet_Change事件来接近复制内置validation的function。 这是一个模拟给你的想法。 你可能会想重构它来cachingValidValues,处理单元格范围的变化等等。

 Private Sub Worksheet_Change(ByVal Target As Range) Dim ValidationRange As Excel.Range Dim ValidValues(1 To 100) As String Dim Index As Integer Dim Valid As Boolean Dim Msg As String Dim WhatToDo As VbMsgBoxResult 'Initialise ValidationRange Set ValidationRange = Sheet1.Range("A:A") ' Check if change is in a cell we need to validate If Not Intersect(Target, ValidationRange) Is Nothing Then ' Populate ValidValues array For Index = 1 To 100 ValidValues(Index) = "Level " & Index Next ' do the validation, permit blank values If IsEmpty(Target) Then Valid = True Else Valid = False For Index = 1 To 100 If Target.Value = ValidValues(Index) Then ' found match to valid value Valid = True Exit For End If Next End If If Not Valid Then Target.Select ' tell user value isn't valid Msg = _ "The value you entered is not valid" & vbCrLf & vbCrLf & _ "A user has restricted values that can be entered into this cell." WhatToDo = MsgBox(Msg, vbRetryCancel + vbCritical, "Microsoft Excel") Target.Value = "" If WhatToDo = vbRetry Then Application.SendKeys "{F2}" End If End If End If End Sub