![]() |
Auto Row Height Protected Template
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 to 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! |
Auto Row Height Protected Template
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 |
All times are GMT +1. The time now is 12:29 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com