Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 4 of 4

Thread: Combo Boxes

  1. #1
    Board Regular
    Join Date
    Apr 2002
    Location
    NSW. Australia
    Posts
    64
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Does anyone know how to get a combo box to look up values in a certain sheet.
    I have tried the following code:
    Private Sub UserForm_Initialize()
    rownumber = [A65536].End(xlUp).Row
    rownumber = rownumber + 1
    Dim wscell As Range
    For Each wscell In Range("Client Details!A1:A25")
    cboDetails.AddItem (wscell.Value)
    Next
    txtDate.SetFocus
    End Sub



    The sheet name is the Client Details. When I remove this reference the combobox works fine.

    Thanks in advance

  2. #2
    Board Regular
    Join Date
    Apr 2002
    Posts
    124
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    How about just:

    cboDetails.ListFillRange = "Client Details!A1:A25"

  3. #3
    Board Regular
    Join Date
    Mar 2002
    Posts
    64
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    It may not work due to lack of single quotes around your spreadsheet name. This is necessary when you have a space in the name. Try:
    For Each wscell In Range("'Client Details'!A1:A25")

    That is a double quote, then single quote, then Client Details, then single quote and etc


    [ This Message was edited by: Fryer Tuck on 2002-05-06 11:15 ]

    [ This Message was edited by: Fryer Tuck on 2002-05-06 11:16 ]

    [ This Message was edited by: Fryer Tuck on 2002-05-06 11:18 ]

  4. #4
    Board Regular
    Join Date
    Apr 2002
    Location
    NSW. Australia
    Posts
    64
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks Fryer Tuck. Once I added the extra quote the problem was solved.

    Cpod I could not get your code to work.
    But thanks anyway

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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