+ Reply to Thread
Results 1 to 19 of 19

Define Object correctly

  1. #1
    Forum Contributor
    Join Date
    12-11-2018
    Location
    Zurich
    MS-Off Ver
    2016
    Posts
    130

    Define Object correctly

    Can someone tell how I should define the object correctly in this workbook?

    Problem occurs in the following code:

    Please Login or Register  to view this content.
    Best, Matthias
    Attached Files Attached Files

  2. #2
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: Define Object correctly

    Try
    Please Login or Register  to view this content.
    Last edited by nigelog; 01-22-2019 at 11:17 AM.

  3. #3
    Forum Contributor
    Join Date
    12-11-2018
    Location
    Zurich
    MS-Off Ver
    2016
    Posts
    130

    Re: Define Object correctly

    .. not working neither..

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Define Object correctly

    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  5. #5
    Forum Contributor
    Join Date
    12-11-2018
    Location
    Zurich
    MS-Off Ver
    2016
    Posts
    130

    Re: Define Object correctly

    ... okey there must be some other problem then.. Still tells me object missing. Gives me the error at :

    Please Login or Register  to view this content.

    So I guess in the second userform is something wrong...

  6. #6
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Define Object correctly

    In second userform.
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    12-11-2018
    Location
    Zurich
    MS-Off Ver
    2016
    Posts
    130

    Re: Define Object correctly

    Okey, now new error at: some problem with column width, which I added now. However then the error occurs at Initialize sequence. The first userform basically runs when I uncomment the second userform. SO there is some problem.. I uploaded againg the updated file.
    Attached Files Attached Files

  8. #8
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: Define Object correctly

    In what order are the userforms called??
    Attached Files Attached Files
    Last edited by nigelog; 01-23-2019 at 06:20 AM. Reason: Update

  9. #9
    Forum Contributor
    Join Date
    12-11-2018
    Location
    Zurich
    MS-Off Ver
    2016
    Posts
    130

    Re: Define Object correctly

    first UserForm6

    and about your answer: "Set rng = [IDS]
    ---------
    but you have no named range [IDS]. Sort that first" --> I dont know how that is done since I have the code from somewhere else. I basically thought this help to set an object...
    Last edited by travelkid; 01-23-2019 at 07:52 AM.

  10. #10
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: Define Object correctly

    @mathias, no problem. I'll take another look after lunch

  11. #11
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: Define Object correctly

    Is this the direction you were heading with the two Userforms???
    See attachment
    Attached Files Attached Files
    Last edited by nigelog; 01-23-2019 at 10:10 AM.

  12. #12
    Forum Contributor
    Join Date
    12-11-2018
    Location
    Zurich
    MS-Off Ver
    2016
    Posts
    130

    Re: Define Object correctly

    Yes that is correct, first number 6 then Gebäudegrundlagen..

  13. #13
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: Define Object correctly

    See attached worbook - see if this starts you in the right direction
    Attached Files Attached Files
    Last edited by nigelog; 01-23-2019 at 12:28 PM.

  14. #14
    Forum Contributor
    Join Date
    12-11-2018
    Location
    Zurich
    MS-Off Ver
    2016
    Posts
    130

    Re: Define Object correctly

    This is what Im looking for.. I tried to implement your solution into my actual project. There are however errors, I dont know why... So if you have time.. I need to apply this solution to several userforms, so maybe you could describe whats wrong here also..

    Thank you very much..
    Attached Files Attached Files
    Last edited by travelkid; 01-24-2019 at 04:25 AM.

  15. #15
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: Define Object correctly

    I have sorted the issues for the two first userforms.
    You are going to have to take this in steps. You made changes to the textbox numbering but did not reflect it in the code. You need to remove all non relevant code so it doesn't confuse. And most especially. Fix one thing before you move onto the next, saving a working copy as you go along.

    See workbook
    Attached Files Attached Files

  16. #16
    Forum Contributor
    Join Date
    12-11-2018
    Location
    Zurich
    MS-Off Ver
    2016
    Posts
    130

    Re: Define Object correctly

    Okey thanks again. Now when I press "neu" in the first userform, there are new errors. The idea behind that is, that I can chose wheather I want to edit old entries or creat a new one. Now will I have to create an funciton for the "neu" button also? I would rahter somehow use my old code which would already do the job to make a new entry..

  17. #17
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: Define Object correctly

    Hi
    it doesn't work that way. So far you have your listbox working in userform6 which you can edit because you are finding the data from the ID number. If you are adding a new entry it is totally different code because now you need to check if already exists and THEN copy the entered data to a NEW row at the bottom of the data.
    I recognise that code from a member here dotchiejac, which means in his original post you would have received a working copy which includes the "add new entry" code which you can adapt to the new forms.

  18. #18
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Define Object correctly

    In your second userform (Gebäudegrundlagen)Initialize change to this.
    Please Login or Register  to view this content.

  19. #19
    Forum Contributor
    Join Date
    12-11-2018
    Location
    Zurich
    MS-Off Ver
    2016
    Posts
    130

    Re: Define Object correctly

    Okey, I managed to make the data in the second userform editable. Now heading to the next one... There is a problem however with the initializing code:

    Please Login or Register  to view this content.
    The idea is going to be, that in this userform the the data UserForm6.LB_00.Column(i) is shown and i in this bracket will be i + 57 or so... However not sure whats wrong right now since it worked on the last one..

    --> I have uploaded the book once more.

    The following procedure to find the error message:

    --> Start at Userform 6.
    --> Chose a entry from list box
    --> press "bearbeiten"
    --> press "aktualisieren"
    --> " ok "
    --> Chose "Wärmebedarf" --> error message occurs.

    Thank you
    Attached Files Attached Files
    Last edited by travelkid; 01-27-2019 at 09:38 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How to correctly define If statements?
    By alocke in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-26-2017, 12:06 PM
  2. keep getting a application define or object define runtime error
    By JRJLHJ1823 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-22-2015, 08:55 PM
  3. Run-time error '1004': Application-define or object define error
    By patua in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 03-26-2014, 05:32 PM
  4. Define object error mid loop.
    By JapanDave in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 12-13-2011, 06:28 AM
  5. error 1004 application define or object define
    By jay11 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-11-2011, 04:09 AM
  6. Passing Object reference correctly?
    By e.good in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-30-2011, 12:47 PM
  7. Object server not correctly registered (Error 336)
    By st24961 in forum Excel General
    Replies: 0
    Last Post: 04-12-2005, 08:52 PM

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