ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Make protected hidden row & column headers appear and rehide based ona cell's value (https://www.excelbanter.com/excel-programming/434206-make-protected-hidden-row-column-headers-appear-rehide-based-ona-cells-value.html)

Michael Lanier

Make protected hidden row & column headers appear and rehide based ona cell's value
 
I need to resize select columns and rows whenever A1="Resize".
Columns and rows are hidden and the sheet is password protected
(password="sparrow"). When A1="Resize", I need the hidden row and
column headers to appear so another macro I have will adjust select
column and row widths and heights. When finished, I need to delete
the A1 "Resize" entry and the headers to once again be hidden and
protected.

Following is the resize macro but it currently does not affect
headers:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("A1").Address Then
Columns("C:C").ColumnWidth = Range("A1").Value
End If
If Target.Address = Range("A2").Address Then
Rows("3:3").RowHeight = Range("A2").Value
End If
End Sub

Thanks for any help that can be given.

Michael

CM

Make protected hidden row & column headers appear and rehide based
 
ActiveWindow.DisplayHeadings = False

"Michael Lanier" wrote:

I need to resize select columns and rows whenever A1="Resize".
Columns and rows are hidden and the sheet is password protected
(password="sparrow"). When A1="Resize", I need the hidden row and
column headers to appear so another macro I have will adjust select
column and row widths and heights. When finished, I need to delete
the A1 "Resize" entry and the headers to once again be hidden and
protected.

Following is the resize macro but it currently does not affect
headers:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("A1").Address Then
Columns("C:C").ColumnWidth = Range("A1").Value
End If
If Target.Address = Range("A2").Address Then
Rows("3:3").RowHeight = Range("A2").Value
End If
End Sub

Thanks for any help that can be given.

Michael


Michael Lanier

Make protected hidden row & column headers appear and rehidebased
 
Thanks CM. It works as expected.

Michael


All times are GMT +1. The time now is 03:32 AM.

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