how do you change a row height in a protected worksheet

V

Vince

I have written a program and I want the end user to be
able to change certain row heights and certain column
widths.
My VB program works fine untill I protect the work sheet.
Is there any way that I can change some of the row heights
and column widths via the program without having to unlock
the worksheet
Thanks
Vince
 
N

Norman Jones

Hi Vince,

If you protect your sheet in code, setting the UserInterfaceOnly argument
to true, you will be able to manipulate the row heights in your code.

Note, however, that the value of this argument is not persistant and, on
re-opening the workbook, the sheet will be protected with the default
(false) value set for this argument.

A solution to this is to protect the worksheet when the workbook is opened,
for example:

Sub Auto_Open
Dim WS As Worksheet

Set WS = Worksheets("Sheet1")

WS.Protect Password:="hi", userinterfaceonly:=True
End Sub
 
N

Norman Jones

Hi Vince,

I omitted to add:

Alternatively,In your code you can unprotect, adjust your row heights and
then re-protect your sheet.
 
G

Guest

Thank you Norman
I like this method better as it will give the operator to
adjust the rows that I will allow within the program.

Vince
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top