+ Reply to Thread
Results 1 to 6 of 6

open second userform depending on cell content

  1. #1
    Forum Contributor
    Join Date
    08-04-2008
    Location
    West Calder, Scotland
    MS-Off Ver
    365
    Posts
    418

    Question open second userform depending on cell content

    Good evening folk

    Im trying to have this code open 1 or 2 forms depending on cell content.

    When the workbook opens it will show a copyright notice, this is set to only show for 3 seconds

    then only if the date in cell ak2 in sheet 3 in within the next 30 days also open the sopreview form.... if the date is greater than the next 30 days the second form should not show


    Many thanks

    JT


    Please Login or Register  to view this content.
    Last edited by JamesT1; 11-04-2011 at 03:31 PM.

  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: open second userform depending on cell content

    Hello JamesT1,

    What is the code failing to do?
    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
    Forum Contributor
    Join Date
    08-04-2008
    Location
    West Calder, Scotland
    MS-Off Ver
    365
    Posts
    418

    Re: open second userform depending on cell content

    Hi Leith Ross

    As the code stands, when I open the workbook I receive a message telling me of a 'Compile error hidden workbook: ThisWorkbook'

    If I remove the 'End if' below the Copyright show, then I get the copyright window followed by the 'sopreview' form,,, I get this each time even when the date in sheet 3 cell ak2 is not within the next 230 days.......

    JT

  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: open second userform depending on cell content

    Hello JT,

    Is this code in you Personal.xlsx workbook or a regular workbook? I ask because the Personal.xlsx is normally hidden. Using ThisWorkbook in a macro refers to the workbook the macro is running in. Normally, in the Personal.xlsx, you would use ActiveWorkbook to have the macro perform an action on the visible workbook.

  5. #5
    Forum Contributor
    Join Date
    08-04-2008
    Location
    West Calder, Scotland
    MS-Off Ver
    365
    Posts
    418

    Re: open second userform depending on cell content

    Hi Leith Ross

    The code is is a regular 'This Workbook',,, I have attached a workbook with the codes and forms to show what is happening

    many thanks#
    Attached Files Attached Files

  6. #6
    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: open second userform depending on cell content

    Hello JT,

    I removed Module1 because this code is not needed and it belongs in the UserForm. I changed the code in the CopyRight form to unload instead of hide.
    Please Login or Register  to view this content.

    It is easier to unload UserForms than hide them. If a UserForm is hidden and you try to show it again, an error will occur. Rather than keep track of which UserForms are hidden, unload them after they close.

    Run the attached workbook and let me know what issues remain.
    Attached Files Attached Files

+ 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