ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   is it possible to use macros when the sheet is protected (https://www.excelbanter.com/excel-discussion-misc-queries/46821-possible-use-macros-when-sheet-protected.html)

Dajana

is it possible to use macros when the sheet is protected
 
My sheet is protected but still I am able to paste information into cells.
However I have written a macro that allows me to change the size of the row
if the size of the text is bigger than the size of the cell. It seems
however that I am unable to use this feature when the sheet is protected. Is
there a way to solve this problem and use this macro when the sheet is
protected.

Thanks

Dave Peterson

In xl2002+, you can allow formatting (including rowheight) when you protect the
worksheet.

You could also protect the sheet in code and tell xl you want to let macros
change things on that protected worksheet.

Option Explicit
Sub auto_open()
With Worksheets("sheet1")
.Protect Password:="hi", userinterfaceonly:=True
End With
End Sub

It needs to be reset each time you open the workbook. (excel doesn't remember
it after closing the workbook.)

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Or you could just add some code to unprotect the worksheet, change the
rowheight, then reprotect the worksheet.

Dajana wrote:

My sheet is protected but still I am able to paste information into cells.
However I have written a macro that allows me to change the size of the row
if the size of the text is bigger than the size of the cell. It seems
however that I am unable to use this feature when the sheet is protected. Is
there a way to solve this problem and use this macro when the sheet is
protected.

Thanks


--

Dave Peterson


All times are GMT +1. The time now is 08:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com