+ Reply to Thread
Results 1 to 3 of 3

UserForm displays incorrectly

Hybrid View

  1. #1
    Registered User
    Join Date
    09-13-2010
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2013
    Posts
    9

    UserForm displays incorrectly

    The code below is intended to run several subs to do calculations and should pop up a userform with a text message (form is called ProgressFrm) that the calculations are in progress. The userform contains only a text label. The form has yellow background as does the label and the text is dark. It is a non-modal or modeless form so it will stay open until unloaded. When I click the rectangle on the worksheet, the form appears but the background and text area are blank (white.) When I run in the VBA debugger and step through, the form appears correctly when ProgressFrm.Show is executed. The balance of the code executes correctly and the form unloads as expected. Why the problem when not in the debugger.? If I place a msgbox statement after the ProgressFrm.Show statement, the form displays properly when the rectangle is clicked but this defeates my intent to not require the extra user action.
    Sub Rectangle6_Click()
    If IsEmpty(Range("SelectedDependent")) Then
    MsgBox "Please Select A Dependent Variable for Regression"
    Exit Sub
    End If
    ProgressFrm.Show
    Application.ScreenUpdating = False
    Call ClearRegressionResults
    Call TestRegression
    Worksheets("GetData").Select
    Application.ScreenUpdating = True
    Unload ProgressFrm
    End Sub
    Last edited by Mal_in_Houston; 09-13-2010 at 03:50 PM. Reason: Added Code Tags

  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,259

    Re: UserForm displays incorrectly

    Hello Mal_In_Huston,

    Welcome to the Forum!

    The easiest way to correct this problem is to force the UserForm to be redrawn using the Repaint method.
    Sub Rectangle6_Click()
    If IsEmpty(Range("SelectedDependent")) Then
    MsgBox "Please Select A Dependent Variable for Regression"
    Exit Sub
    End If
    ProgressFrm.Show
    ProgressFrm.Repaint
    Application.ScreenUpdating = False
    Call ClearRegressionResults
    Call TestRegression
    Worksheets("GetData").Select
    Application.ScreenUpdating = True
    Unload ProgressFrm
    End Sub
    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
    09-13-2010
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2013
    Posts
    9

    Re: UserForm displays incorrectly

    Thanks.. that worked just like you said it would.. Not sure why its necessary though. What I found to be annoying is that the action in normal operation did not behave like it did when executed line by line in the debugger which is what you want to use to diagnose issues. If anyone else has an explanation of why please post even though a soluton has been found.

+ 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