Problem with Floating Form

Posted on 2014-02-04
Medium Priority
Last Modified: 2014-02-04
Byundt helped me with a Macro that allowed the creation of a floating option box by calling a Form.  In the sample he sent me, it worked perfectly and we closed out the Question.  When I put it into my production file, the form worked but when I put the cursor in any cell, I could not "scroll".  I believe the reason may have something to do with the fact that my production file has a 4 level outline.

Take the file attached, and click on "Select Detail". You will see the options and if you fire any of the buttons/macros, it works perfectly (collapsing and expanding the outline). BUT, you can't scroll.


Question by:Bright01
LVL 81

Expert Comment

ID: 39833945
You didn't set the ShowModal property of the userform to False.

After making that change, the code should work.
LVL 25

Assisted Solution

by:Ejgil Hedegaard
Ejgil Hedegaard earned 400 total points
ID: 39833950
The form has focus and block any other selection.
Change the line in module1 to

Selection.Show vbModeless

Click on the sheet, and you can scroll
LVL 81

Accepted Solution

byundt earned 1200 total points
ID: 39833959
I added a statement selecting the active cell after showing the modeless userform. In so doing, you can scroll right away.
Private Sub Worksheet_Activate()
Dim cel As Range
Set cel = ActiveCell
End Sub

Open in new window

To change the ShowModal property of a userform:
1.  Click on the userform in the VBA Editor
2.  If the Property pane isn't already displayed, use the View...Properties menu item to display it.
3.  Change the ShowModal property to False, then hit Enter
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

LVL 52

Assisted Solution

by:Martin Liss
Martin Liss earned 400 total points
ID: 39833968
You can't scroll a worksheet when you are displaying a userform so your only choice if you want to use the userform is to add the add the Unload me lines in that form's code as shown here.

Option Explicit

Private Sub FunctionalArea_Click()
Unload Me

End Sub

Private Sub UseCaseDetails_Click()
Unload Me

End Sub

Private Sub UseCases_Click()
Unload Me

End Sub

Private Sub ValueProposition_Click()
Unload Me

End Sub

Open in new window

Doing that would however IMO make the form redundant since you can do the same thing by clicking the other buttons on the sheet.
LVL 81

Expert Comment

ID: 39833980
You can't scroll a worksheet when you are displaying a userform
That might be true in other languages, but you can definitely scroll the worksheet in Excel while displaying a modeless userform.

Author Closing Comment

ID: 39834023
Wow....thanks guys!  Lots of options here..... I changed the Modal to "False" and added Brundt's code.

Nice "tweak".
LVL 52

Expert Comment

by:Martin Liss
ID: 39834030
I stand corrected.

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

588 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question