P
Pavan Kishore K. S.
Hi,
I am trying to create a validation list through a macro. The code i am using
is as follows:
'Open the excel sheet where the valdiation list is to be added
Set objExcel = CreateObject("Excel.Application")
ExcelToBeOpened = Application.GetOpenFilename(filefilter:="Excel Files,
*.xls")
objExcel.Workbooks.Open Filename:=ExcelToBeOpened
objExcel.Visible = True
'The validation list is to be created in another excel sheet that is open
With objExcel.Workbooks(1).Worksheets("Sheet1").Range("N3:N1000").Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop,
Operator:=xlBetween, Formula1:="Yes,No"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
But this doesnt seem to work. Any ideas why and what change should be done?
Thanks
I am trying to create a validation list through a macro. The code i am using
is as follows:
'Open the excel sheet where the valdiation list is to be added
Set objExcel = CreateObject("Excel.Application")
ExcelToBeOpened = Application.GetOpenFilename(filefilter:="Excel Files,
*.xls")
objExcel.Workbooks.Open Filename:=ExcelToBeOpened
objExcel.Visible = True
'The validation list is to be created in another excel sheet that is open
With objExcel.Workbooks(1).Worksheets("Sheet1").Range("N3:N1000").Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop,
Operator:=xlBetween, Formula1:="Yes,No"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
But this doesnt seem to work. Any ideas why and what change should be done?
Thanks