Auto Row Height Protected Template

I

IlanK

Hi,

I have a template that I created in Excel.
When I enter text in the unlocked cells I'd like for the row height t
automatically adjust (it's on wrap text at the moment).

I'm not very familiar with macro coding, so how do I do this?

Thanks
 
B

benmcclave

Hi,

Try this code. You'll need to put it in the sheet's code (right-click tab name and click "View Code").

- Ben

Private Sub Worksheet_Change(ByVal Target As Range)
Dim strPWD As String
'Plug in sheet password to unprotect
strPWD = ""

If Not Target.Locked Then
If Sheet1.ProtectContents = True Then
Sheet1.Unprotect (strPWD)
Target.Rows.EntireRow.AutoFit
Sheet1.Protect (strPWD)
Else
Target.Rows.EntireRow.AutoFit
End If
End If
End Sub
 

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