+ Reply to Thread
Results 1 to 5 of 5

Type mismatch problem

  1. #1
    Registered User
    Join Date
    05-13-2008
    Posts
    14

    Type mismatch problem

    I am completely new to VBA and am trying to create a user form that will fill-in TextBoxes dependent on the value of ComboBoxes.

    We have a dozen or so separate workbooks which this form will be placed in for data entry purposes.

    The source of the data ranges for the ComboBoxes and TextBoxes is being kept in a separate workbook for ease in updating and editing the data.

    I am getting an error msg:

    Run-time error '-2147352571 (80020005)':
    "Could not set the property value. Type mismatch"

    When I click on Debug this is the line that becomes highlighted:

    Please Login or Register  to view this content.
    I have tried everything I could find googling this error,
    changing the ListItem As Variant, i As Integer to i As Variant;
    taking out the ListItem As Variant, i As Integer line all together;
    adding a line with Textbox() As Variant...(Like I said, I am extremely new to VBA)..

    When I look at the cells in both excel sheets - the cells are all "formatted" as General, so I am not sure what their data type is ...?

    I REALLY would appreciate any suggestions..... PLEASE HELP!!

    This is my code -

    Please Login or Register  to view this content.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,507
    Hi,
    It is difficult to duplicate the problem with out seeing the workbook,
    could you attach the workbook?
    Please Login or Register  to view this content.
    maybe should be
    Please Login or Register  to view this content.
    not sure what it is supposed to do, do you want textbox1 to show the selection of combobox1?

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Your code is opening the sourcewb and populating the Textbox by offsetting by the Listindex of the combobox & one column.

    Try

    Please Login or Register  to view this content.
    Can you explain what exactly the offset should be

    You need to remember that the ListIndex starts at 0 so add 1, maybe this is what you want

    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Registered User
    Join Date
    05-13-2008
    Posts
    14
    Dave and Roy,

    Thank you both so much for responding to my plea for help!

    Roy I used:

    Please Login or Register  to view this content.
    and it seems to be working like a charm!!
    Here's what it looks like now:

    Please Login or Register  to view this content.

    I need to do the same thing for 10 more pairs of ComboBoxes/TextBoxes - will having that many cause any problems do you think?

    Once again, thank you both - it is truly appreciated!
    Bernadette

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    The number of comboboxes should not be a problem

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1