Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88854

Trying to Translate Data Validation in from VBA to VB.NET

$
0
0

I have some code where I am trying to build a data validation box. I have setup on how I want it in VBA, but I am unsure on how this is supposed to look in VB.Net

I am using this as a guide from Davy C from How to pass values from an array to a drop down list in a certain cell (not combo list) in excel VBA

The raw data validation code can be shown here:

Dim myArray
myArray = Array("1", "2", "3")

Range("A"& 1).Select

With Selection.Validation
    .Delete
    .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
    xlBetween, Formula1:=myArray(0) & ","& myArray(1) & ","& myArray(2)
    .IgnoreBlank = True
    .InCellDropdown = True
    .InputTitle = ""
    .ErrorTitle = ""
    .InputMessage = ""
    .ErrorMessage = ""
    .ShowInput = True
    .ShowError = True
End With

Viewing all articles
Browse latest Browse all 88854


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>