+ Reply to Thread
Results 1 to 10 of 10

user related macro problem

  1. #1
    Registered User
    Join Date
    08-04-2008
    Location
    Blackpool
    Posts
    22

    user related macro problem

    Here's a weird one for you...

    i am using the macro below to get excel to hide all sheets but the one called "open"...

    PHP Code: 
    Sub savemini()

    ActiveWorkbook.Unprotect "letmein"

      
    For Each sh In ThisWorkbook.Worksheets
           
    If Not sh.Name "open" Then sh.Visible xlVeryHidden
       Next sh

        ActiveWorkbook
    .Save
    End Sub 
    So the workbook is protected with the password "letmein", and the VB code above in theory should unlock the workbook, allowing all visible sheets to be hidden with the exception of the sheet called "open". Then is saves the file.

    Now heres the odd bit... it works for certain people, but not for others. I have made sure those it wont work for are not doing anything weird and they are not.

    The workbook i am using has a code that only opens certain sheets for certain users. I as a master user have access to all sheets. I can go into the users sheets and click the button that activates the macro above myself and it works fine, but for some users it wont work.


    Anyone got an idea why this is happening?

    It's nothing to do with security settings or locked sheets (have tried both of those already!)

  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
    Hello Thanatos,

    My guess is you are sharing this workbook. Having multiple users change the protection on various sheets is a disaster in the making. Each user should have their own workbook with only the sheets he or she needs.

    Sincerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    08-04-2008
    Location
    Blackpool
    Posts
    22
    Quote Originally Posted by Leith Ross View Post
    Hello Thanatos,

    My guess is you are sharing this workbook. Having multiple users change the protection on various sheets is a disaster in the making. Each user should have their own workbook with only the sheets he or she needs.

    Sincerely,
    Leith Ross
    Firstly, apologies for the duff title! (got my warning! :D) any mods please feel free to change it to something more practicle like "user related macro problem" or something

    Regarding the problem - no user is changing the protection on any sheet. There is just a simple macro that runs on open only allowing certain sheets (dependent on the user) to be visible. The workbook is not "shared" as such - e.g. only one user can use it at a time. However it is in a shared folder so everyone involved can have access to it. So none of the reasons you give should be effecting it. (Having seperate workbooks for 30 members of staff and having to maintain them all would be a logistical nightmare! :D)

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,441
    What error to the users get?


    ensure the "OPEN" worksheet is visible before hiding all the others.
    Cheers
    Andy
    www.andypope.info

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Thanatos, I have asked you to change your Thread Title. Please do so before I lock this post!
    Hope that helps.

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

    Free DataBaseForm example

  6. #6
    Registered User
    Join Date
    08-04-2008
    Location
    Blackpool
    Posts
    22
    Quote Originally Posted by Andy Pope View Post
    What error to the users get?


    ensure the "OPEN" worksheet is visible before hiding all the others.
    The message is "Run time error '1004' Unable to set the visible property of the worksheet class"


    The open tab isnt showing when they run this... i will look into that - thanks! (although surely that would stop it working for everyone rather than a select few?)




    Many thanks royUK for your help with changing the thread title!

  7. #7
    Registered User
    Join Date
    08-04-2008
    Location
    Blackpool
    Posts
    22
    Andy Pope - worked a treat - bloody obvious now I think about it! lol

    Cheers all!

  8. #8
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,441
    do you know for certain that the file is in the same state for all users.
    no chance they changed something?

  9. #9
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You will need to re-protect the workbook. This code should unhide open if it is closed, & hide all others

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    08-04-2008
    Location
    Blackpool
    Posts
    22
    Quote Originally Posted by Andy Pope View Post
    do you know for certain that the file is in the same state for all users.
    no chance they changed something?
    Yeah, they have about 5 cells they can enter information in (how much work they did that day) and thats it. I made it idiot proof (famous last words)


    And good point about re-protecting the work book - thx royuk

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Answer Excel 'yes/no' question in Macro without user intervention?
    By dingman4 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-10-2007, 01:35 PM
  2. Excel macro problem
    By rishi in forum Excel General
    Replies: 2
    Last Post: 04-11-2007, 09:35 PM
  3. Macro problem, after inserting new row, paste special
    By cheeky in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-29-2007, 04:36 PM
  4. Date Format problem in User Form
    By vandanavai in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-27-2006, 11:07 PM
  5. Macro for calculation and user entry in same cell?
    By umax in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 11-19-2006, 10:07 PM

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