我正在嘗試使用vba代碼創建數據驗證列表。該數組根據許多變量生成自身。使用vba數組驗證列表
這裏是我使用
For iter4 = 2 To nbWsheet
If Wsheet.Cells(iter4, 2) = Cat And Wsheet.Cells(iter4, ColMod) = "x" And Wsheet.Cells(iter4, ColStd) = "oui" Then
TableValue = Wsheet.Cells(iter4, 4).Value & " - " & Wsheet.Cells(iter4, 7).Value
Table = Table & "," & TableValue
End If
Next iter4
'Ajout de la list
With Cells(iGlob, 5).Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:=Table
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = ""
.ShowError = ""
End With
這段代碼的問題的代碼,是在表中的文本包含「」。當生成的數據驗證列表,每次都看到「」它把文本在新行...
有沒有一種方法,以保持「」表
爲例內我想顯示:123456 - 發動機,300馬力
希望我是清楚的,
感謝,
你幾乎清楚...但你能顯示你嘗試使用的數據嗎?可能是一個截圖。 –
我知道這樣做的唯一方法是將您的列表輸出到一個單元格區域,然後設置Formula1以引用該單元格區域。您可以隱藏單元格,或將其放入隱藏的工作表中。 – tigeravatar
查看[這裏](http://stackoverflow.com/questions/30724178/create-data-validation-list-when-some-of-the-values-have-commas)爲同一個問題和一些創新的答案。 – tigeravatar