[RESOLVED] creating dropdown list in excel cell in vb.net
I am creating an excel file and have to add a dropdown list to a cell. It looks like I need data validation, but my attempt errored on the .Add line.
Any ideas??
With wkbSheet.Range("H" & rowCt).Validation
.Delete()
.Add(Type:=Excel.XlDVType.xlValidateWholeNumber, _
AlertStyle:=Excel.XlDVAlertStyle.xlValidAlertInformation, Formula1:=lstString)
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
:confused: THanks
Re: creating dropdown list in excel cell in vb.net
Ok, found it myself,
With wkbSheet.Range("H" & rowCt).Validation
.Add(Type:=Excel.XlDVType.xlValidateList, AlertStyle:=Excel.XlDVAlertStyle.xlValidAlertStop, Operator:=Excel.XlFormatConditionOperator.xlBetween, Formula1:="=$M$1:$M$3")
End With
enjoy!
Re: [RESOLVED] creating dropdown list in excel cell in vb.net
Hi,
U added the content to ur dropdown from the same excel sheet.
Can we able to add the data to drop down in excel from VB combo box using VB.NET?