Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Simplfy if statement
How would one simplify the following:
If Target.Count 1 Then GoTo errHandler If Target.Column = 7 Then Target.Columns.ColumnWidth = 15 Else Columns(7).ColumnWidth = 8 If Target.Column = 8 Then Target.Columns.ColumnWidth = 25 Else Columns(8).ColumnWidth = 15 End If If Target.Column = 3 Then Target.Columns.ColumnWidth = 10 Else Columns(3).ColumnWidth = 8 End If If Target.Column = 4 Then Target.Columns.ColumnWidth = 10 Else Columns(4).ColumnWidth = 8 End If End If Cheers |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Simplfy if statement
Hi Jim
Perhaps: If Target.Count 1 Then GoTo errHandler Range("C1,D1,G1").ColumnWidth = 8: Range("h1").ColumnWidth = 15 Select Case Target.Column Case 3, 4 Columns(Target.Column).ColumnWidth = 10 Case 7 Columns(Target.Column).ColumnWidth = 15 Case 8 Columns(Target.Column).ColumnWidth = 25 Case Else End Select Richard On 30 Nov, 09:16, Jim wrote: How would one simplify the following: If Target.Count 1 Then GoTo errHandler If Target.Column = 7 Then Target.Columns.ColumnWidth = 15 Else Columns(7).ColumnWidth = 8 If Target.Column = 8 Then Target.Columns.ColumnWidth = 25 Else Columns(8).ColumnWidth = 15 End If If Target.Column = 3 Then Target.Columns.ColumnWidth = 10 Else Columns(3).ColumnWidth = 8 End If If Target.Column = 4 Then Target.Columns.ColumnWidth = 10 Else Columns(4).ColumnWidth = 8 End If End If Cheers |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Simplfy if statement
Thanks Reichard,
It seems so simple but constantly reminds me of how much I have to learn - or adopt from the truly learned. Cheers Jim "RichardSchollar" wrote: Hi Jim Perhaps: If Target.Count 1 Then GoTo errHandler Range("C1,D1,G1").ColumnWidth = 8: Range("h1").ColumnWidth = 15 Select Case Target.Column Case 3, 4 Columns(Target.Column).ColumnWidth = 10 Case 7 Columns(Target.Column).ColumnWidth = 15 Case 8 Columns(Target.Column).ColumnWidth = 25 Case Else End Select Richard On 30 Nov, 09:16, Jim wrote: How would one simplify the following: If Target.Count 1 Then GoTo errHandler If Target.Column = 7 Then Target.Columns.ColumnWidth = 15 Else Columns(7).ColumnWidth = 8 If Target.Column = 8 Then Target.Columns.ColumnWidth = 25 Else Columns(8).ColumnWidth = 15 End If If Target.Column = 3 Then Target.Columns.ColumnWidth = 10 Else Columns(3).ColumnWidth = 8 End If If Target.Column = 4 Then Target.Columns.ColumnWidth = 10 Else Columns(4).ColumnWidth = 8 End If End If Cheers |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can an If statement answer an If statement? | Excel Discussion (Misc queries) | |||
How to simplfy If & Sumif Code | Excel Discussion (Misc queries) | |||
appending and IF statement to an existing IF statement | Excel Worksheet Functions | |||
If statement and Isblank statement | Excel Worksheet Functions | |||
Help please, IF statement/SUMIF statement | Excel Worksheet Functions |