![]() |
Running Code on Hidden Worksheet
We have a basic workbook that managers use to record comments (good or bad)
about other managers. When an entry is made, the manager's name is entered in column A, the date in column B and the comment in column C. The workbook is available to all managers. However, when a manager opens it, we don't want him/her to see any entries made about themselves; rather, they can see only entries about other managers. I've successfully created code that captures the user's Windows login name as a means to hide any row containing their name. The code starts by selecting the first cell in column A (which I call "Start"), looking down that column for any instances of the user's name, and hiding the row. Protection is then applied to prevent users from unhiding the rows. My challenge is how to have this code run while that worksheet is hidden, then only display it after the user's rows have been hidden (I want to hide the worksheet upon opening because I don't want the user to have a temporary glimpse of it before the code actually runs). Because my code starts with Range("Start").Select, I get an error message because the worksheet is hidden to begin with. Thanks in advance for any help/suggestions for overcoming this issue! -- Steve C |
Running Code on Hidden Worksheet
On Feb 13, 10:16 am, Steve C wrote:
We have a basic workbook that managers use to record comments (good or bad) about other managers. When an entry is made, the manager's name is entered in column A, the date in column B and the comment in column C. The workbook is available to all managers. However, when a manager opens it, we don't want him/her to see any entries made about themselves; rather, they can see only entries about other managers. I've successfully created code that captures the user's Windows login name as a means to hide any row containing their name. The code starts by selecting the first cell in column A (which I call "Start"), looking down that column for any instances of the user's name, and hiding the row. Protection is then applied to prevent users from unhiding the rows. My challenge is how to have this code run while that worksheet is hidden, then only display it after the user's rows have been hidden (I want to hide the worksheet upon opening because I don't want the user to have a temporary glimpse of it before the code actually runs). Because my code starts with Range("Start").Select, I get an error message because the worksheet is hidden to begin with. Thanks in advance for any help/suggestions for overcoming this issue! -- Steve C Not sure. One thing I do know is that when saving a document it will always open to the last sheet viewed. You could, simply enough, just code it to switch to the main page and then save and close after a manager submits a comment, whereafter opening the document returns you to the main page. Otherwise perhaps consider a 'view content' button and using white text ("invisible") before the hiding and unhiding begins. Im sure someone will come in with some real code though:) |
Running Code on Hidden Worksheet
Yes it can be done but you can not use the selects. That being said if this
info is confidential then I would recommend that Excel not be used. Any protection or other form of security that you apply can be very easily defeated. If you still intend to use XL and want help you will need to post your code. -- HTH... Jim Thomlinson "Steve C" wrote: We have a basic workbook that managers use to record comments (good or bad) about other managers. When an entry is made, the manager's name is entered in column A, the date in column B and the comment in column C. The workbook is available to all managers. However, when a manager opens it, we don't want him/her to see any entries made about themselves; rather, they can see only entries about other managers. I've successfully created code that captures the user's Windows login name as a means to hide any row containing their name. The code starts by selecting the first cell in column A (which I call "Start"), looking down that column for any instances of the user's name, and hiding the row. Protection is then applied to prevent users from unhiding the rows. My challenge is how to have this code run while that worksheet is hidden, then only display it after the user's rows have been hidden (I want to hide the worksheet upon opening because I don't want the user to have a temporary glimpse of it before the code actually runs). Because my code starts with Range("Start").Select, I get an error message because the worksheet is hidden to begin with. Thanks in advance for any help/suggestions for overcoming this issue! -- Steve C |
All times are GMT +1. The time now is 02:02 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com