Macro on a protected worksheet in a shared workbook.

Hi,
I have a macro in protected worksheets that can't run once the Workbook is 
Shared.
I have wrapped the Macro code so as the worksheet is unprotected for the 
time the Macro runs, and unable the Autofilter.
The code is as follow at the moment:

Sub Newaction()

Sheets("Critical Path").Unprotect ("")
' Newaction Macro
' Macro recorded 17/11/2004 by Clifford
'

'
    Selection.AutoFilter Field:=1, Criteria1:="="
    Sheets("Critical Path").EnableAutoFilter = True
    Sheets("Critical Path").Protect contents:=True, userInterfaceOnly:=True
    Sheets("Critical Path").Protect ("")
End Sub

Can Someone assist me me ???
 Thank you so much in advance.
 Regards

Paul.
0
Paul297 (622)
11/19/2004 1:17:01 AM
excel.misc 78881 articles. 5 followers. Follow

1 Replies
530 Views

Similar Articles

[PageSpeed] 37

You can't can't change the protection of a worksheet in a shared workbook.



Paul. wrote:
> 
> Hi,
> I have a macro in protected worksheets that can't run once the Workbook is
> Shared.
> I have wrapped the Macro code so as the worksheet is unprotected for the
> time the Macro runs, and unable the Autofilter.
> The code is as follow at the moment:
> 
> Sub Newaction()
> 
> Sheets("Critical Path").Unprotect ("")
> ' Newaction Macro
> ' Macro recorded 17/11/2004 by Clifford
> '
> 
> '
>     Selection.AutoFilter Field:=1, Criteria1:="="
>     Sheets("Critical Path").EnableAutoFilter = True
>     Sheets("Critical Path").Protect contents:=True, userInterfaceOnly:=True
>     Sheets("Critical Path").Protect ("")
> End Sub
> 
> Can Someone assist me me ???
>  Thank you so much in advance.
>  Regards
> 
> Paul.

-- 

Dave Peterson
0
ec357201 (5290)
11/19/2004 2:32:54 AM
Reply:

Similar Artilces:

spell check does not visually cycle through cells when run from macro?
I'm trying to recreate the same behavior in a macro that spellcheck has when the spellcheck button is pressed. The spellcheck does not cycle through the cells visually when run from a macro, so when there is a misspelled word, you cannot see the cell it is a part of. If anyone knows how I can get this behavior to work, it would be GREATLY appreciated. I did a record new macro, and got code similar to the following: Sub testSpelling() Range("F2:F500").Select Selection.CheckSpelling SpellLang:=1033 End Sub thanks, dan Dan, Add the fiollowing to your code as shown: ...

Limited Password Protection
Is there way to put password protection for preventing modifications in original file. but still allow copy and paste from the original file to another? Thanks, Sameer Hi Sameer I'm afraid password protection is ON or OFF there's no limited protection AFAIK -- john ATSIGN PPTAlchemy.co.uk Free PPT Hints, Tips and Tutorials http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html "Sameer" wrote: > Is there way to put password protection for preventing modifications > in original file. but still allow copy and paste from the ...

Disappearing emails from a shared mailbox
I set up a shared mailbox for one of our departments, and last night, when the mail user of it closed Outlook, the mails disappeared from the mailbox. I have logged directly onto the mailbox myself, and the historical mails are definitely not there. I have checked each users deleted items, and used the deleted items recovery tool in case one of them accidentally deleted the mails. all to no avail. whilst we can revoer from a backup tape, i would like to get to the bottom of how this has happened. has anyone had the same problem before? Check to see if 1 of the users had a archive or P...

Setting directory for file save in macro
Hi Thanks to a generous poster I now have a great bit of code to use in a macro for Excel which saves a text file (I'm no VBA programmer so this was really helpful), i.e.: Open "Test.txt" For Output As #1 (rest of code) My problem now is this: The macro saves test.txt to Excel's current active folder, rather than the folder that the current workbook is contained in. For example, if I last saved an Excel workbook to c:\workbooks\, and the workbook that I have open exists in c:\workbooks\workbook1\, when I run the macro it saves the text file in c:\workbooks\. If I ...

Calendar sharing #3
Hello all, the current exchange setup is as follows: 1. domain A.... is windows 2000, with exchange 5.5 and is hosted in Organization A 2. domain B .... is windows 2003, with exchange 2003 and is hosted in Organization B Is there a way for users from both domains to access the other's calendar ( for example, user 1 in domain A wants to access user 2 in domain B)? Any input is appreciated. Thanks. Diana Hi Diana, You may consider the InterOrg Replication Utility to accomplish this. Read more about it here: http://www.microsoft.com/downloads/details.aspx?FamilyId=E7A951D7-155...

How do I fix a workbook.
I have a workbook with 5 sheets and macros with forms. When I select any one of the worksheets by the tab with the mouse, the cursor goes to a page and the only way I can get Excel to stop is to cancel the task. How do I either fix this workbook or copy all the sheets to another workbook? TIA -- Bill What version of Excel, Bill? Have you tried File-->Open and choose the Repair option? ************ Anne Troy www.OfficeArticles.com "bill" <bill@discussions.microsoft.com> wrote in message news:C5CBB482-1057-4B14-9277-B5FBAA9D866B@microsoft.com... >I have a workboo...

Can you record a macro in Publisher like you can in Excel?
In Excel I use the feature to Record a Macro. Excel records the keystrokes and converts to VB. Does Publisher have that option? In my version, Publisher 2003, I can Create a Macro, and it takes me into VB. However, I don't know how to code VB. Darlene wrote: > In Excel I use the feature to Record a Macro. Excel records the keystrokes > and converts to VB. Does Publisher have that option? In my version, > Publisher 2003, I can Create a Macro, and it takes me into VB. However, I > don't know how to code VB. Publisher does not have a Macro Recorder, sorry. --...

Macros/Signatures Question
I have an Excel Workbook that I created for a PC Order Form. I set it up to only make certain rows visible based on the Machine Model that they choose. I digital signed the Worksheets and exported the Digital Signature Certificate and installed it on the User’s PCs. The code works great. The user opens the Workbook and it runs the Macros with no problem. The problem I have is when the user goes to save the Workbook. They get an error that “Excel can not sign VBA macros when saving to this file format. Do you want to remove the digital signature and continue saving this workbook?”...

Protecting Application by Admin Password.
Hi All, How I can Protect my Mfc application by asking for Admin Password/ Username? Is there any API to do this? Any Samples will be of great Help. Thanks in Advance. Prash What's the purpose of that? Arbitrary applications should NOT ask for admin username/password, it's not their business. Only LSA should get them. <prashanthaputta@rediffmail.com> wrote in message news:1172392260.217834.127740@p10g2000cwp.googlegroups.com... > Hi All, > > How I can Protect my Mfc application by asking for Admin Password/ > Username? Is there any API to do this? > > An...

Macro Copy and Paste
I am currently trying to copy from one workbook that has 7 differen tabs and paste into one worksheet on a separate master workbook. M problem is that when I set up the macro to copy from one of the tabs i the workbook and paste to the other work book, I only want the the row to come in where there is data. Currently I am having to run a macr that takes every 100 lines, but ideally I only want the informatio copy and pasted where there is only data. In addition, once I have copy and pasted everything from the first tab my next step is to copy and paste information from the second tab t th...

Referring to a FileName in Macro
I have a Macro with the following code Application.Run "TestQry!Macro2" Application.Run "TestQry!Macro1" TestQry is the name of the file. Is there anyway that this macro cod can refer to the activeWorkbook or filename so that if the file i saved to a new name this macro will still ru -- Message posted from http://www.ExcelForum.com How about just: macro2 or even call macro2 "DoctorV <" wrote: > > I have a Macro with the following code > > Application.Run "TestQry!Macro2" > Application.Run "TestQry!Macro1" > &g...

Macro Question #10
Hi, I am working with a text file that I imported into Excel. It is a transactional report of sales by customer. The data will have the customer number and name spread out over three cells. What I want to do is to create a macro that will contatenate all three cell and then perform a paste special and paste them into another cell in another column. Since the number of transactions by customer can vary the customer name and number can appear anywhere on the page. I created a macro to do this using the first customer which appears in cell B5 through D5. The next customer appears...

Shared offline files
Does anyone have experience using shared workbooks in conjunction with the Win2000 Offline Files feature? We used to use the Win95/Office95 briefcase function successfully, but with the advent of Office 97 shared Excel files wouldn't merge. Spent time with MS tech support documenting the problem but was never fixed. Was hoping functionality had returned in Office/Windows 2000. Thanks in advance, Jeff ...

Can i move multiple lines between workbooks
I have a .csv format file listing speed cameras, and the different speeds are identified by two characters at the end of each line - 30, 40, 50 etc. I would like to create separate files for each speed, but Excel won't allow me to cut/copy several lines to created a new file/workbook. Is there any way round this? Martin Ellis Sun, 16 Sep 2007 03:28:00 -0700 from Martin Ellis <MartinEllis@discussions.microsoft.com>: > I have a .csv format file listing speed cameras, and the different speeds are > identified by two characters at the end of each line - 30, 40, 50 etc...

Excel2000: Strange behaviour for one cell in workbook
Hi The situation: There is a Excel workbook used for registering working time in firm departments, created earlier. The worksheets are protected, and I don't have the password, as author isn't working here anymore. The workbook is stored as read-only on network resource, and monthly every department is copying it to local computer and filling the table. The table's body has 2 rows data for every employee with 31 columns for month's dates, and several protected summary columns. For every date, working hours or some code string is entered into according cell. One of codes, and ...

I cannot paste from one workbook to another. Copy works, paste do.
When I attempt to copy from one workbook and paste into another, copy appears to work but paste does not. The paste menu item is grayed out in the workbook to which I attempt to paste. Are there setting that can be changed to aloow the paste?? Check to see if either workbook and/or worksheet is protected. If so, unprotect. Then Copy/Paste should work. BTW, how are you copy?paste(ing) Tab or content? Dennis "JimmyMc" wrote: > When I attempt to copy from one workbook and paste into another, copy appears > to work but paste does not. The paste menu item is grayed out...

Spreadsheet macro stopped working!
Hi, I recently made an Excel spreadsheet for keeping track of my golf score. The spreadsheet is quite simple. It consists of 4 sheets: Scorecard, statistics, database and equations (for calculating some specific). I insert informations about the golf course I'm playing and how my score was etc. I then hit a button "Save scorecard" that runs a macro. The macro inserts specifik values from the scorecard into the database sheet (which works like a charm). The macro also updates the "Statistics" sheet with information about stroke number and points for ...

Printing a worksheet on 11x17 paper
I want to print a worksheet on 11x17 paper. When I try to change to that paper size in print options, there is no size like that available. What do I do??? thank you for your help in this matter. Katie It's the printer that decides that.. Do you have that option on the printer it should be available in Excel -- Regards, Peo Sjoblom "Katie" <anonymous@discussions.microsoft.com> wrote in message news:9fca01c4345c$bcdca970$a301280a@phx.gbl... > I want to print a worksheet on 11x17 paper. When I try > to change to that paper size in print options, there is ...

how do I prevent a worksheet from being copied in excel
yet allow users to select values in a defined range Good evening kensanjose You really need to supply more information about what you mean - cop the file/sheets/ranges etc Dominic -- dominic ----------------------------------------------------------------------- dominicb's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1893 View this thread: http://www.excelforum.com/showthread.php?threadid=38531 How do I prevent a worksheet from being copied in excel? Can I disable right click within a file so that the sheet cannot be copied into another file and manipula...

Excel 2007 macro compatability
I have created a macro in Excel 2007 that includes importing a text file. It works fine on my PC, but fails on a co-workers PC running Excel 2000. The failure points to the "TextFile Platform" command in the macro. I have tried several (437, 1252, 20127), but get the same results. Any solution? Thanks you. Have you try xlWindows -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Al @ Frontier" <Al @ Frontier@discussions.microsoft.com> wrote in message news:3F601F80-F099-42C8-AA18-6D31A85946F9@microsoft.com... >I have cr...

User authentication/protection
I'm a professor and use Excel extensively in my classes. I need to be able to assign Excel projects to my students and have some increased assurance that the students have submitted their own work. I've tried my hand at VBA programming and also simply used track changes. None of these solutions (even the track changes) worked reliably across both mac and pc platforms. I would like some advice about whether what I need from Excel is even possible. I Here's what I need and what I think would work: 1. I'd like to prevent a student from getting someone else's sol...

Help Locking Worksheet
I inherited a workbook that has several sheets, have gone thru and mad changes and now when I lock it I cannot go from the last table cell o the first row to the second row. Tabbing will just continue you out o the same row. I want to be on cell BD3, hit tab and go to C5. Does the fact that I have the to & leftmost cells frozen have anythin to do with this? How can I fix it -- jlabshe ----------------------------------------------------------------------- jlabsher's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1556 View this thread: http://www.excelfo...

Name a worksheet tab with data in a cell
I have Excel 2002 and would like to rename a worksheet tab with a cell reference. Example, name the tab "John Doe" his name is located in cell b2. each time I change the value in b2, the name of the tab will change accordingly. Hi Donovan, In the worksheet's module (right-click the sheet's tab | View Code), paste the following: Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Not Intersect(Target, Range("B2")) Is Nothing Then Me.Name = Target.Value End If End Sub --- Regards, Norman "donovan" <anonymous@discussions...

Excel E-mail Macros
I need to know how to create a macro that will send an excel file as an attachment to one individual, and then send one of the file's worksheets to 3 e-mail addresses using the mail recipient method so that the worksheet appears in the body of the e-mail. The e-mail program I am using is Outlook. Any help with this will be GREATLY appreciatd. Hi John, I'd tell you, but Ron de Bruin already did all the work. It'd be silly for me to do it again...Try Ron's site: http://www.rondebruin.nl/sendmail.htm tim "John" <jbegley@dcas.nyc.gov> wrote in message ne...

format macro
Last week, Art was trying to help me with this, but the solution doesn't work for me. I'm looking for a macro that would be contained within my personal.xls, that I could use as needed. Lets say I have A1:C5 selected, which represent headdings and data for jan, feb and march. [On a different spreadsheet, it may be different columns, or a different number of columns. The point is that I will select the range before I run the macro.] I want to do an auto fit for each column, so that the column widths are big enough to fit the numbers. No problem, format-->column-->autof...