+ Reply to Thread
Results 1 to 4 of 4

Compile Error with User from

  1. #1
    Registered User
    Join Date
    06-26-2006
    Posts
    16

    Compile Error with User from

    Hi,

    I am using an online tutorial (http://www.contextures.com/xlUserForm02.html) to create a user form with combo boxes. Unfortunately the tutorial's actual code lacks the needed commenting so some of the commands are lost on me. I believe i have modified the code to fit my project, however, after i attempt to run the user form i get the error "method or data member not found" and the compiler points me to the "offset" function specifically. Since i am not quite sure what the function does, i am not sure how to troubleshoot it. Any help or suggestions would be greatly appreciated.

    Below is my code in its entirety.

    Private Sub UserForm_Initialize()
    Dim cPartType As Range
    Dim cLoc As Range
    Dim cPartClass As Range
    Dim cWhouse As Range
    Dim ws As Worksheet
    Set ws = Worksheets("LookUpLists")

    For Each cPartType In ws.Range("PartTypeList")
    With Me.cboPartType
    .AddItem cPartType.Value
    .List(.ListCount - 1, 1) = cPart.Offset(0, 1).Value
    End With
    Next cPartType

    For Each cLoc In ws.Range("LocationList")
    With Me.cboLocation
    .AddItem cLoc.Value
    .List(.ListCount - 1, 1) = cLoc.Offset(0, 1).Value
    End With
    Next cLoc

    For Each cPartClass In ws.Range("PartClassList")
    With Me.cboPartClass
    .AddItem cPartClass.Value
    .List(.ListCount - 1, 1) = PartClass.Offset(0, 1).Value
    End With
    Next cPartClass

    For Each cWhouse In ws.Range("WarehouseList")
    With Me.cboWhouse
    .AddItem cWhouse.Value
    .List(.ListCount - 1, 1) = cWhouse.Offset(0, 1).Value
    End With
    Next cWhouse

    For Each cLoc In ws.Range("LocationList")
    With Me.cboLocation
    .AddItem cLoc.Value
    .List(.ListCount - 1, 1) = cLoc.Offset(0, 1).Value
    End With
    Next cLoc

    'Not quite sure what the below does, especially "set focus"
    'Me.txtDate.Value = Format(Date, "Medium Date")
    'Me.txtQty.Value = 1
    'Me.cboPart.SetFocus

    End Sub

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Merritts,

    It would be faster and easier if you post your workbook. There a many places where errors could occur in this project, and not knowing your exact layout complicates the troubleshooting even more. If you want to e-mail me a copy of your workbook, you can send to me at [email protected] and I will gladly look it over for you.

    Sincerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    06-26-2006
    Posts
    16
    Leith,

    Thanks! i sent you my workbook.

    Andrew

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Andrew,

    I sent the corrected workbook. Have a look and let me know if you find any more problems.

    Sincerely,
    Leith Ross

+ 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