+ Reply to Thread
Results 1 to 6 of 6

Use sheetname to open a Userform

  1. #1
    Registered User
    Join Date
    12-06-2004
    Posts
    18

    Use sheetname to open a Userform

    Hi

    I want to Show a different Userform based on the sheet its opened from. I have tried code below but the UserForm name is in the wrong format but can’t find the correct Dim, can anyone help please? The target Userform is ‘cables_form’.

    Snippet:-

    Tried both of these:-
    Please Login or Register  to view this content.
    I am using Excel 2000

    Andrew
    Last edited by mudraker; 08-01-2007 at 07:24 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Follow the Forum Rules & wrap code with Code Tags

    can I ask why have you different forms for different sheets?
    Hope that helps.

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

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    12-06-2004
    Posts
    18
    Hi Roy

    The workbook has 4 sheets, each for a different type of survey and different data to enter. Also each column has different rules applied to it i.e. max 4 characters, change OS map references from alpha – numeric to all numeric etc.

    I could have a different macro button for each page but thought this would be easy and just gather the sheetname and goto the correct Userform.

    Andrew

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

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-06-2004
    Posts
    18
    Quote Originally Posted by royUK
    here's one way

    Please Login or Register  to view this content.
    Hi

    I tried your suggestion but it didn't seem to work so I tired this:-

    Please Login or Register  to view this content.
    but no joy but is probably wrong use of 'Case' anyway. So I ended up with :-

    Please Login or Register  to view this content.
    Thanks for your help, Andrew

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    The Select case is correct, you haven't given sWsName a value as far as I can see. The code I posted works fine for me.

+ 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