LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Combo box error on form

Hi
I'm having a problem with a form, I use a combo box to select values from,
but when I read the cell on the work sheet it refers to, it the cell is
empty it come up with an error. I thought that - Subsyst.AddItem "" ,
would handle it but it doesn't, any help would be appreciated


this is the code I use to populate the combo box

Private Sub addSubsyst()
Subsyst.AddItem ""
Subsyst.AddItem "S01" 'ListIndex = 1
Subsyst.AddItem "S02" 'ListIndex = 2
Subsyst.AddItem "S03" 'ListIndex = 3
Subsyst.AddItem "S04" 'ListIndex = 4
Subsyst.AddItem "S05" 'ListIndex = 5
Subsyst.AddItem "S06" 'ListIndex = 6
Subsyst.AddItem "S07" 'ListIndex = 7
Subsyst.AddItem "S08" 'ListIndex = 8
Subsyst.AddItem "S09" 'ListIndex = 9
Subsyst.AddItem "S10" 'ListIndex = 10
Subsyst.AddItem "S12" 'ListIndex = 11
Subsyst.AddItem "N/A" 'ListIndex = 12


'Use drop-down list
Subsyst.Style = fmStyleDropDownList
'Combo box values are ListIndex values
Subsyst.BoundColumn = 0
'Set combo box to first entry


Subsyst.Width = 60
Subsyst.ListWidth = 55

End Sub

And this to read from the work sheet to populate the form with data

Private Sub getmine()
Select Case itmnum
Case 4 To LastRow - 1
Itemnumbx.Text = Cells(itmnum, 1)
Itemdescr.Text = Cells(itmnum, 2)
Spec.Text = Cells(itmnum, 3)
Wesnum.Text = Cells(itmnum, 4)
Locat.Text = Cells(itmnum, 5)
valadd.Text = Cells(itmnum, 6)
evatxt.Text = Cells(itmnum, 7)
nvatxt.Text = Cells(itmnum, 8)
walk.Text = Cells(itmnum, 9)
auto.Text = Cells(itmnum, 10)
ComboBox1 = Cells(itmnum, 11)
Subsyst.Text = Cells(itmnum, 18)

Case Else
Itemnumbx.Text = itmnum - 3
ClearData

End Select
DisableSave

End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
combo box - VBA form Roy Gudgeon[_2_] Excel Discussion (Misc queries) 3 March 15th 10 12:20 PM
linking a form combo box... results from the combo box to another Trey Excel Discussion (Misc queries) 1 July 15th 07 01:58 AM
Can't seem to get Combo Box on User Form [email protected] Excel Programming 5 April 25th 05 11:15 AM
Run Time Error 424 Combo Box User Form Jennifer Excel Programming 3 April 7th 05 08:23 PM
Form Combo Box Jeff Excel Discussion (Misc queries) 1 December 15th 04 04:10 PM


All times are GMT +1. The time now is 08:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"