Excel Data validation lists from within VB


Posted by Vik Kala on February 23, 2001 8:16 AM


Hi Guys,
I am creating a VB application where I am opening and
manipulating an excel spreadsheet as an object.
I am populating the spreadsheet with the contents of a
data recordset in my code.
I wanted to create a DATA VALIDATION LISTBOX from within
my VB code. This might be a very simple thing to achieve,
but my problem is that I am not too familiar with Excel.
I will appreciate any input on this.
Thanks,
Vik



Posted by Dave Hawley on February 23, 2001 8:49 AM

Hi Vik

With Range("A1").Validation
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=$B$1:$B$14"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = "OzGrid"
.ErrorTitle = "OzGrid"
.InputMessage = "Select from list"
.ErrorMessage = "Sorry, not part of the list."
.ShowInput = True
.ShowError = True
End With


Any good ?

Dave

OzGrid Business Applications