+ Reply to Thread
Results 1 to 7 of 7

Selecting which userform to use based on cell selection

  1. #1
    Registered User
    Join Date
    06-08-2011
    Location
    Harrisburg PA
    MS-Off Ver
    Excel 2007
    Posts
    2

    Selecting which userform to use based on cell selection

    Ok, long story short, i have a userform named "UserFormSPHIX" and I need to set that equal to some type of object or variable named "oUserForm" so that the following piece of code will execute properly:

    oUserForm.Label1.Caption = "generic string of text"

    The code i currently have looks like this:

    Dim oUserForm as UserForm
    set oUserForm = UserFormSPHIX

    oUserForm.Label1.Caption = "generic string of text"

    however, this does not change the caption of label1. It doesn't give me any error message, it just doesn't do anything! Any help would be GREATLY appreciated!
    Last edited by Zigaria1; 06-08-2011 at 09:10 AM.

  2. #2
    Valued Forum Contributor mohd9876's Avatar
    Join Date
    05-04-2011
    Location
    Amman, Jordan
    MS-Off Ver
    Excel 2010
    Posts
    426

    Re: Userform help

    try this:
    Please Login or Register  to view this content.

  3. #3
    Valued Forum Contributor mohd9876's Avatar
    Join Date
    05-04-2011
    Location
    Amman, Jordan
    MS-Off Ver
    Excel 2010
    Posts
    426

    Re: Userform help

    by the way,, is there a code somewhere that shows the user form?? if the form is not shown the label will not change, you should have something like this
    Please Login or Register  to view this content.

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

    Re: Userform help

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    PLEASE PM WHEN YOU HAVE DONE THIS AND I WILL DELETE THIS POST
    Hope that helps.

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

    Free DataBaseForm example

  5. #5
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,256

    Re: Userform help

    Also, I'm afraid:

    Your post does not comply with Rule 8 of our Forum RULES. Cross-posting is when you post the same question in other forums on the web. You'll find people are disinclined to respond to cross-posts because they may be wasting their time solving a problem that has been solved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser)to the cross-post. Expect cross-posts without a link to be closed a message will be posted by the moderator explaining why. We are here to help so help us help you!

    Read this to understand why we ask you to do this.
    Remember what the dormouse said
    Feed your head

  6. #6
    Registered User
    Join Date
    06-08-2011
    Location
    Harrisburg PA
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Selecting which userform to use based on cell selection

    Thanks Mohd9876, that seems a lot better than what I had, but it still doesn't work. I'll include more of the code that I'm using below so you can better see the problem.

    Please Login or Register  to view this content.
    The above code works to an extent. It will show UserFormSPHIX (assuming that I click on cell C9 in the workbook) but it won't update any of the userform's objects. For instance, oUserForm.Fund_Ticker.Caption = [A9] doesn't do anything.

  7. #7
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,256

    Re: Selecting which userform to use based on cell selection

    Still waiting for those cross-post links...

+ 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