Results 1 to 13 of 13
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Fill combobox.... (2000 sr 1)

    why not work????? do until the last cell is blank into range AA2:AA50
    If Left((ComboBox1.Value), 9) = "SK-4003-T" Then

    ComboBox2.Clear

    For Each Cell In Foglio2.[AA2:AA50]
    ComboBox2.AddItem Cell
    Next Cell

    End If

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Fill combobox.... (2000 sr 1)

    What exactly is the problem? "why not work?????" is not specific enough.

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Fill combobox.... (2000 sr 1)

    accccccccccccccccarrrgggggg....
    Cnacel the last post, see now
    this is my idea but peraphs not is correct the range :

    Dim lngMaxRow As Long

    lngMaxRow = Sheets("CODICI").Range("AA65536").End(xlUp).Row

    If Left((ComboBox1.Value), 9) = "SK-4003-T" Then

    ComboBox2.Clear

    For Each Cell In Sheets("CODICI").Range("AA2 :AA (& lngMaxRow)")
    ComboBox2.AddItem Cell
    Next Cell

    End If

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Fill combobox.... (2000 sr 1)

    I have to ask again: what is the problem? You post some code, but you don't tell us what is wrong:
    - Do you get an error message?
    - Is the result not what you wanted? If so, what did you want and how is the result different?

  5. #5
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Fill combobox.... (2000 sr 1)

    now....
    I wolud want to file the combobox2 with all value into range AA2:AA50 until the last cell into range is blank....
    now have error to set the range in peraphs the sintyax not is correct:

    For Each Cell In Sheets("CODICI").Range("AA2 :AA & lngMaxRow")

  6. #6
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Fill combobox.... (2000 sr 1)

    How about this:

    For Each Cell In Sheets("CODICI").Range("AA2:AA" & lngMaxRow)

    Steve

  7. #7
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Fill combobox.... (2000 sr 1)

    TKS...
    Now, assuming the condition is valid for many value similar:

    Dim lngMaxRow As Long
    lngMaxRow = Sheets("CODICI").Range("AA65536").End(xlUp).Row

    If Left((ComboBox1.Value), 9) = "SK-4001-G" Or Left((ComboBox1.Value), 9) = "SK-4002-G" Or Left((ComboBox1.Value), 9) = "SK-4003-T" Or Left((ComboBox1.Value), 9) = "SK-3001-S" Or Left((ComboBox1.Value), 9) = "SK-4004-S" Or Left((ComboBox1.Value), 9) = "SK-4005-S" Or Left((ComboBox1.Value), 9) = "SK-4006-S" Then

    ComboBox2.Clear

    For Each Cell In Sheets("CODICI").Range("AA2:AA" & lngMaxRow)
    ComboBox2.AddItem Cell
    Next Cell

    End If

    inested to use variuos OR statement is possible to use a case select?

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Fill combobox.... (2000 sr 1)

    Yes:

    Select Case Left(ComboBox1.Value, 9)
    Case "SK-4001-G", "SK-4002-G", "SK-4003-T", "SK-3001-S", "SK-4004-S", "SK-4005-S", "SK-4006-S"
    ComboBox2.Clear
    ...
    End Select

  9. #9
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Fill combobox.... (2000 sr 1)

    Work perfect, as usual...
    Tks for patience!.

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Fill combobox.... (2000 sr 1)

    Try this:

    ...
    ComboBox2.Clear
    Select Case Left(ComboBox1.Value, 9)
    Case "SK-4001-G", "SK-4002-G", "SK-4003-T", "SK-3001-S", "SK-4004-S", "SK-4005-S", "SK-4006-S"
    For Each Cell In Sheets("CODICI").Range("AA2:AA" & lngMaxRow)
    ComboBox2.AddItem Cell
    Next Cell
    Case Else
    For Each Cell In Intersect(Foglio2.UsedRange, Foglio2.<!t>[E2:E65536]<!/t>)
    ComboBox2.AddItem Cell
    Next Cell
    End Select
    ...

  11. #11
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Fill combobox.... (2000 sr 1)

    work!
    ... but when i select other item, after one a selction in combobox1, in combox2 are a blank line...why?

  12. #12
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Fill combobox.... (2000 sr 1)

    Because you want the combo box to be refilled each time. I don't know how to prevent this.

  13. #13
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Fill combobox.... (2000 sr 1)

    Messaggio cancellato da sal21

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •