+ Reply to Thread
Results 1 to 3 of 3

Worksheet Control in Userform

  1. #1
    Registered User
    Join Date
    08-03-2011
    Location
    Norwich
    MS-Off Ver
    Excel 2010
    Posts
    28

    Worksheet Control in Userform

    Hi Guys

    I have an worksheet embedded into a Userform which outputs some information from a database.

    What I am trying to do is add some autofilters in VBA.

    Basically I am stuck fast, nothing I have used before works, I guess this is because the worksheet control is somehow different from an actual worksheet?

    Even trying to select a range for the autofilter results in an 'The range you are trying to select is not completely in the viewable range' error.

    Has anyone figured out how to do this in a worksheet control? This is what I am trying:

    Please Login or Register  to view this content.
    Cheers

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Worksheet Control in Userform

    You need to edit out all the "selecting" in your macros. Recorded macros show this syntax because it's recording your human actions, but it's not the right way to do it in the end.

    So, send your commands directly to the fully addressed objects, no selecting:

    Please Login or Register  to view this content.

    Now that the selecting is removed, those commands can work because you're not trying to show anything onscreen, it's just "doing it" on the other sheet while out of view. Much more efficient.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

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

    Re: Worksheet Control in Userform

    Spreadsheet Controls are no longer available from Excel 2007 & were never well supported. I haven't got the control on my PC now but you need to use the Object Browser to check out the way it is used. To be honest it's not worth the effort, I would use a listBox.
    Hope that helps.

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

    Free DataBaseForm example

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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