View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Minitman[_4_] Minitman[_4_] is offline
external usenet poster
 
Posts: 273
Default TextBox RowSource Question

Hey Tom,

There are a few items in your code that I am not familiar with. And
that is great! I will now attempt to understand how they works and
make use of them.
Thank you, I would never have even suspected that some of these
commands existed, let alone what they do.

As always, I am in your debt.

-Minitman

On Sun, 13 Feb 2005 20:45:52 -0500, "Tom Ogilvy"
wrote:

Public bBlockEvent as Boolean

Private Sub Userform_Initialize()
Dim cell as Range
bBlockEvents = True
combobox1.Clear
combobox2.Clear
for each cell in Range("List").Columns(1).Cells
Combobox1.AddItem cell.Value
Combobox2.AddItem cell.Offset(0,1).Value
Next
bBlockEvents = False
End Sub

Private Sub Combobox1_Click()
if bBlockEvents = True then exit sub
If Combobox1.Value = "" then exit sub
if Trim(Combobox2.Value) = "" then
on Error goto ErrHandler
bBlockEvents = True
for each cell in Range("List").columns(1).Cells
if lcase(cell.Value) = Combobox1.Value then
combobox2.AddItem cell.Offset(0,1).Value
end if
Next
End if
combobox2.ListIndex = 0
ErrHandler:
bBlockEvents = False
End Sub

Private Sub Combobox2_Click()
if bBlockEvents = True then exit sub
If Combobox2.Value = "" then exit sub
If Trim(Combobox1.Value) = "" then
on Error goto ErrHandler
bBlockEvents = True
for each cell in Range("List").columns(2).Cells
if lcase(cell.Value) = Combobox2.Value then
combobox1.AddItem cell.Offset(0,-1).Value
end if
Next
End if
combobox1.ListIndex = 0
ErrHandler:
bBlockEvents = False
End Sub

Untested, but it should give you some ideas.