Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15516

[RESOLVED] Error on filling ComboBox from Excel named range.

$
0
0
I'm trying to fill a Combobox with values from a named range in excel and can't figure out why I'm getting an error in the For loop. Here's my code:


Code:

  Public Sub FillAlbumStatusCombo(ByVal Excel_VSA_NEW As Class_Excel_Files)

        ComboBox_VsaStatus.Items.Clear()

        Excel_VSA_NEW.OWS = Excel_VSA_NEW.OWBa.Worksheets("INTERNAL")

        For Each cell As Excel.Range In Excel_VSA_NEW.OWS.Range("rng_VsaStatus_main").Cells
            ComboBox_VsaStatus.Items.Add(cell.Value.ToString)
        Next

    End Sub

I also tried selecting the range which also gives an error.

Code:

Excel_VSA_NEW.OWS.Range("rng_VsaStatus_main").Select()
Name:  devenv_xDVnDFL4Le.jpg
Views: 29
Size:  10.8 KB
Attached Images
 

Viewing all articles
Browse latest Browse all 15516

Trending Articles



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