Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 219
Default Lists not working w/ userform

I have a userform which is supposed to find a value in column A, then find
all corresponding values in col B. Somehow, it's not working. Here is the
code:

Private Sub cboCode_Change()
Dim rCodes As Range

cboFacilities.Clear

For Each rCodes In Range("codeList").Cells
If rCodes.Text = cboCode.Text Then
cboFacilities.AddItem rCodes.Offset(0, 1).Text
End If
Next

End Sub

Private Sub usfFacilNameID_Activate()
Dim rCodes As Range
Dim iCodes As Integer
Dim bCodes As Boolean
Dim ws As Worksheet
Dim sFacilName As String

Set ws = ActiveSheet


cboCode.Clear

For Each rCodes In Range("codeList").Cells
bCodes = True
For iCodes = 0 To cboCode.ListCount - 1
If cboCode.List(iCodes) = rCodes.Text Then
bCodes = False
Exit For
End If
Next
If bCodes Then
cboCode.AddItem rCodes.Text
End If
Next
End Sub
Private Sub cbOK_Click()
Dim ws As Worksheet
Dim sFacilName As String
Dim iFacilID As Integer

On Error Resume Next
sFacilName = usfFacilIDName.cboFacilities
iFacilID = usfFacilIDName.cboCode
On Error GoTo 0

Set ws = ActiveSheet

If sFacilName = "" Then
MsgBox "Please select an ID No.", vbOKOnly
With Me.cboCode
' .SelStart = 0
' .SelLength = Len(.Text)
.SetFocus
End With
Else
Me.Hide
End If
ws.Range("C1").Value = sFacilName
End Sub

Does anyone see the disconnect between the columns on the spreadsheet, ID
in col A, Facil name in col B?
Thanks!
Reply
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
lists not populating userform salgud Excel Programming 1 March 22nd 10 10:27 PM
Working with lists ArthurN Excel Discussion (Misc queries) 2 January 11th 09 08:00 AM
Working with custom lists [email protected] Excel Programming 2 July 31st 06 03:42 PM
Working with Lists in Excel 2003 ksp Excel Worksheet Functions 0 August 12th 05 08:23 AM
Working with lists JSnader Excel Programming 1 November 23rd 03 02:47 PM


All times are GMT +1. The time now is 09:38 PM.

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

About Us

"It's about Microsoft Excel"