BarefootPaul
Board Regular
- Joined
- Jul 21, 2011
- Messages
- 54
Here is the code I wrote that doesn't work because I don't know how to set the column nnumber as an appropriate variable (I think that is the problem):
Can anyone help me with this?
Thanks
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim iColumn As Integor
If Target.Count > 1 Then Exit Sub
iColumn = Target.Column
If iColumn = 6 Or 10 Or 14 Or 18 Or 22 Or 26 Then
Target.Columns.ColumnWidth = 20
Else
Columns(iColumn) = 3
End If
If iColumn = 7 Or 11 Or 15 Or 19 Or 23 Or 27 Then
Target.Columns.ColumnWidth = 20
Else
Columns(iColumn) = 12
End If
If iColumn = 8 Or 12 Or 16 Or 20 Or 24 Or 28 Then
Target.Columns.ColumnWidth = 20
Else
Columns(iColumn) = 3
End If
End Sub
Can anyone help me with this?
Thanks