+ Reply to Thread
Results 1 to 10 of 10

UserForm not Displaying Correctly

  1. #1
    Registered User
    Join Date
    01-05-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    17

    UserForm not Displaying Correctly

    Hello again,

    I have built a UserForm (Excel 2003) that looks up a Row dependant on Criteria and displays the values on the User Form. See Below

    Please Login or Register  to view this content.
    The UserForm then runs the following.

    Please Login or Register  to view this content.
    The problem I'm having is that when running through the processes step by step it all works perfectly but when actualy running from a command button, its like it is to fast for it and the UserForm either does not display all the details or is a mixture of the current and previous Rows details.

    Does anyone know why or how to remedy this?


    Regards
    Last edited by Strugglin; 02-01-2009 at 09:00 AM.

  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

    Re: UserForm not Displaying Correctly

    Hello Strugglin,

    Move your code from the UserForm_Initialize() event procedure to the UserForm_Activate() procedure. Use the initialize procedure to load values into TextBoxes, Comboxes, and ListBoxes. Use the Activate event for dynamic data. What is happening is the data changes but not in sync with the UserForm events. Because the UserForm is busy, it doesn't see the repaint command.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    01-05-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: UserForm not Displaying Correctly

    Hi Leith,

    I dont know what the hell is going on now. I really hate Userforms unless thier basic

    I changed it as you suggested and the " = ActiveCell Then RowNumber" didnt work at all (Is this becuase the Form is already open) so I changed it back.

    Then I noticed that if the Row was "" it would do the " = ActiveCell Then RowNumber" again. It never did that before and I thought this was the problem so I added information to the cells just in case - no luck.

    So I decided to close the WorkBook and didn't save it. I re-opened thinking I would be back to the original problem but now the UserForm doesn't seem to work at all with the " = ActiveCell Then RowNumber".

    UserForms hate me. What am I doing wrong?


    Regards

  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

    Re: UserForm not Displaying Correctly

    Hello Strugglin,

    Obviously you have not made the proper offerings at the VBA alter and the gods are angry! Can you post your workbook for review. It would be the quickest way to resolve these issues.

  5. #5
    Registered User
    Join Date
    01-05-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: UserForm not Displaying Correctly

    LOL Leith, sometimes it seems like that.

    The work book is quite large so I have supplied a smaller version, still with the same problems. and I haven't even got to editing data part yet..

    Also if you could answer this, when I was running it before and it was working? why does it copy the requeted Row to the 1st Row? Surely it would be easier to link the Rows directly for editing.

    Anyway let me know how you get on.


    Thanks again

    Strugglin.xls

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: UserForm not Displaying Correctly

    It looks like you may have a variable 7 a button with the same name - RowNumber. This may cause problems.

    Your activate code could be shorter, what about
    Please Login or Register  to view this content.
    If you are using the button RowNumber then you need to RowNumber.Caption, not just RowNumber.
    Last edited by royUK; 01-30-2009 at 06:59 AM.
    Hope that helps.

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

    Free DataBaseForm example

  7. #7
    Registered User
    Join Date
    01-05-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: UserForm not Displaying Correctly

    Hi Roy, thanks for the input.

    RowNumber is actually a TextBox on the Edit UserForm that dictates what row to select for the UP and DOWN buttons. Altering this number engages the "RowNumber_Change" Sub that calls the GetData Sub again.

    I shall muck around with your column suggestion though and see if I can put it to good use.


    Thanks

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: UserForm not Displaying Correctly

    I'll take a closer look at the form later.

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

    Re: UserForm not Displaying Correctly

    Hello strugglin,

    OK, I got it working. There were a few errors. Here is the macro for the "Add Contact" button. I removed the code to hide the UserForm. Let the user dismiss the form when they ready.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    01-05-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: UserForm not Displaying Correctly

    I changed the name of the TextBox called "RowNumber" to some other name.
    Last edited by Strugglin; 02-01-2009 at 01:29 PM.

+ 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