[英]How to import xml data with XMLDOM using a comma as decimal separator
[英]Comma Separator: Ignore the comma within the data using excel macro
我是使用Excel宏vba的新手,並且在下拉列表中列出數據時遇到問題。 我想創建一個下拉列表,並且在一行記錄中有一個逗號,但是我的代碼將其分開。 這是我的代碼。
碼:
Dim ShipAddress As String
Dim MyList5() As String
ReDim MyList5(ShipAddressCount)
For h = 1 To ShipAddressCount
ShipAddress = rsShipAddress!ShippingAddress
MyList5(h) = ShipAddress
rsShipAddress.MoveNext
Next
With Range("E4:E" + cnt).Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:=Join(MyList5, ",")
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
當列表具有“名稱,名稱”的下拉記錄時,它將被視為兩行。 我想在列表中有一條記錄,並在一行中有一個逗號。 你們還有其他解決方法嗎?
任何幫助將不勝感激。 謝謝。
您可以將值放入一列單元格中,將其設置為“命名范圍”(我通常以“ DrpDwn_”開頭以顯示它們是“下拉列表”),然后使用該列表將其指向“命名范圍”。
例如,如果您的命名范圍是“ DrpDwn_Shipping”,則可以使用Formula1:="=DrpDwn_Shipping"
這種方法的問題是,當然,對於每個不同的下拉列表,您都需要一個列和一個“命名范圍”,最好在一個非常隱藏的工作表上。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.