Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / COM / December 2005



Tip: Looking for answers? Try searching our database.

Combo Boxes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steven - 07 Dec 2005 13:11 GMT
Hello,

I'm trying to populate my combo box with a list held within a
spreadsheet without success.

Currently I'm using a while statement to get the information where in a
specific cell range.

Has anyone got any pointers
Paul Clement - 07 Dec 2005 15:42 GMT
¤ Hello,
¤
¤ I'm trying to populate my combo box with a list held within a
¤ spreadsheet without success.
¤
¤ Currently I'm using a while statement to get the information where in a
¤ specific cell range.
¤
¤ Has anyone got any pointers

Could you provide a bit more detail and post some code? I'm assuming the ComboBox is on a VB Form
and not an Excel Worksheet or Form.

Paul
~~~~
Microsoft MVP (Visual Basic)
Steven - 07 Dec 2005 15:48 GMT
yep on a VB form accessing the worksheet data, sorry. It cuurently
works on a column on the same sheet however when I'm trying utilise it
on another column it's failing.

here's the code

Private Sub UserForm_Initialize()

Dim WeekList As String, icount As Integer

icount = 2

While Worksheets("Variables").Range("A" & icount).Value <> ""

   WeekList = Worksheets("Variables").Range("A" & icount).Value

   cboWeek.AddItem WeekList
   
   icount = icount + 1

Wend

End Sub
Paul Clement - 07 Dec 2005 18:33 GMT
¤ yep on a VB form accessing the worksheet data, sorry. It cuurently
¤ works on a column on the same sheet however when I'm trying utilise it
¤ on another column it's failing.
¤
¤ here's the code
¤
¤
¤ Private Sub UserForm_Initialize()
¤
¤
¤ Dim WeekList As String, icount As Integer
¤
¤ icount = 2
¤
¤ While Worksheets("Variables").Range("A" & icount).Value <> ""
¤
¤     WeekList = Worksheets("Variables").Range("A" & icount).Value
¤
¤     cboWeek.AddItem WeekList
¤    
¤     icount = icount + 1
¤
¤ Wend
¤
¤ End Sub

OK, so it looks like an Excel (VBA) Form. Are you getting an error when using a different column?

Paul
~~~~
Microsoft MVP (Visual Basic)
Steven - 09 Dec 2005 14:04 GMT
Yep, but it's ok, I've solved it, I just reset icount back to 2 when
looking at the new column in the new range (it's always something
simple isn't? Thanks for your help!!
Steven - 09 Dec 2005 14:04 GMT
Yep, but it's ok, I've solved it, I just reset icount back to 2 when
looking at the new column in the new range (it's always something
simple isn't? Thanks for your help!!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.