ManvinderKaur
Board Regular
- Joined
- Jun 16, 2010
- Messages
- 149
Hi All
I have used following code to enlarge a cell width when focused
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target.Column = 2 Then
Target.Columns.ColumnWidth = 55
Else
Columns(2).ColumnWidth = 25
Me.Range("B8:B39").WrapText = True
End If
End Sub
It works well when sheet is not protected. But it gives error "Unable to set coloumnWidth property of range class". How to fix this problem. I need sheet protected as well as coloumn width change. Thanks
I have used following code to enlarge a cell width when focused
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target.Column = 2 Then
Target.Columns.ColumnWidth = 55
Else
Columns(2).ColumnWidth = 25
Me.Range("B8:B39").WrapText = True
End If
End Sub
It works well when sheet is not protected. But it gives error "Unable to set coloumnWidth property of range class". How to fix this problem. I need sheet protected as well as coloumn width change. Thanks