View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Konrad[_2_] Konrad[_2_] is offline
external usenet poster
 
Posts: 7
Default ComboBox Hell!!!

'pls try this
'Create sheet name = mySheet
'insert this code to userform with ComboBox1
Private Sub UserForm_Initialize()

On Error GoTo error_hen
'Worksheets("mySheet").Select
With Worksheets("mySheet").Range("A:A") 'attention! name
of the sheet, range
Set c = .Find(What:="*", LookIn:=xlValue) ' "*" stands
for every not empty
If Not c Is Nothing Then
firstAddress = c.Address

Do
Me.ComboBox1.AddItem c.Value
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <
firstAddress

End If
End With
Exit Sub
error_hen:

MsgBox "Error !"

End Sub
'##############################
'mailto:R_K_Gajda@ poczta.fm