with sheet protection on, macro won't run to add borders around a
If protection is off, the macro runs fine. If the sheet and worksheet
becomes protected, the macro produces a runtime error 1004 that I have no been able to locate how to fix (Visual Basic help was of no help). The debug points to the following: Selection.Borders(xlDiagonalDown).LineStyle = xlNone |
with sheet protection on, macro won't run to add borders around a
Dim wsh as Worksheet
Set wsh=Selection.Parent wsh.UnProtect "Password" <Perform things on the worksheet wsh.Protect "Password" Replace Password with the password of the sheet that is protected. This password is case sensitive. If there is no password, then omit this argument. -- Ronald R. Dodge, Jr. Production Statistician/Programmer Master MOUS 2000 "Lorrie M" <Lorrie wrote in message ... If protection is off, the macro runs fine. If the sheet and worksheet becomes protected, the macro produces a runtime error 1004 that I have no been able to locate how to fix (Visual Basic help was of no help). The debug points to the following: Selection.Borders(xlDiagonalDown).LineStyle = xlNone |
with sheet protection on, macro won't run to add borders around a
If you protect the sheet, then just like manually, code can not change the
things that are protected. the work around is to have your code unprotect the sheet, make the change, reprotect the sheet or look at the UserInterfaceOnly property of the protect methods. -- Regards, Tom Ogilvy "Lorrie M" wrote: If protection is off, the macro runs fine. If the sheet and worksheet becomes protected, the macro produces a runtime error 1004 that I have no been able to locate how to fix (Visual Basic help was of no help). The debug points to the following: Selection.Borders(xlDiagonalDown).LineStyle = xlNone |
with sheet protection on, macro won't run to add borders around a
You can unprotect and re-protect the sheet in the macro. I would tell
you how, but I don't have Excel on the PC I'm writing this on and I don't trust my memory to provide the correct syntax. If you need example code and no one else offers any, reply to this and I'll work something up. (To help with getting a solution: What version of Excel are you using?) Lorrie M wrote: If protection is off, the macro runs fine. If the sheet and worksheet becomes protected, the macro produces a runtime error 1004 that I have no been able to locate how to fix (Visual Basic help was of no help). The debug points to the following: Selection.Borders(xlDiagonalDown).LineStyle = xlNone |
All times are GMT +1. The time now is 07:31 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com