Column width & Row Height changing using macro/vb

R

Ram B

I have a worksheet that has and auto_open script to enable Outlining. I need
help on the command that will allow me to change Row and column widths.

Sub auto_open()
With Worksheets("Passive Safety")
.Protect Password:="password", userinterfaceonly:=True
.EnableOutlining = True
End With
End Sub
 
J

JLGWhiz

This is using the snippets from the VBA help file.
It is pretty simple. You can also use specific
numbers in place of the .RowHeight * 2 Or the
..ColumnWidth * 2.

Sub wdthNhgt()
With Worksheets("Sheet1").Rows(1)
.RowHeight = .RowHeight * 2
End With
With Worksheets("Sheet1").Columns("A")
.ColumnWidth = .ColumnWidth * 2
End With
End Sub
 
R

Ram B

JLGWhiz: The code you have works as a stand alone. Also what i am looking for
is to allow the user to dynamically change the height and width on a
protected sheet. I can do this by checking "Format Columns" & "Format Rows"
when I protect the sheet manually Since I have the following in a code

With Worksheets("Passive Safety").Protect Password:="password" in any script.

Once this is executed the manual checks are over ridden. I tried recording a
macro
while protecting which gives me


AllowFormattingColumns:=True
AllowFormattingRows:=True

I tried to incert this but I got an error.

Any suggestions????????
 

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