M
MichaelB
I need some help making the below script a little smarter. I wish to have the
macro key off of two differ criteria, one being the already present
..Columns.Count = 4 but I also need to include if the text within cell(1,1) =
“Mikeâ€. I have tried to make the if clause read two conditions but it appears
you can't do that (or should I say I can not do it). I have also tried
putting in a nested if but to no avail. Can someone point me in the right
direction?
Need the if clause to meet both conditions:
Columns.Count = 4 AND
Text within the cell(1,1) = “textâ€
Any help would be greatly appreciated..
Mike
********************************************
Sub ResizeTables()
Dim oTbl As Table
For Each oTbl In ActiveDocument.Tables
With oTbl
If .Columns.Count = 4 Then
.AutoFitBehavior Behavior:=wdAutoFitFixed
.Columns.PreferredWidthType = wdPreferredWidthPoints
.Columns(1).PreferredWidth = InchesToPoints(1#)
.Columns(2).PreferredWidth = InchesToPoints(0.69)
.Columns(3).PreferredWidth = InchesToPoints(0.63)
.Columns(4).PreferredWidth = InchesToPoints(3#)
End If
End With
Next oTbl
End Sub
macro key off of two differ criteria, one being the already present
..Columns.Count = 4 but I also need to include if the text within cell(1,1) =
“Mikeâ€. I have tried to make the if clause read two conditions but it appears
you can't do that (or should I say I can not do it). I have also tried
putting in a nested if but to no avail. Can someone point me in the right
direction?
Need the if clause to meet both conditions:
Columns.Count = 4 AND
Text within the cell(1,1) = “textâ€
Any help would be greatly appreciated..
Mike
********************************************
Sub ResizeTables()
Dim oTbl As Table
For Each oTbl In ActiveDocument.Tables
With oTbl
If .Columns.Count = 4 Then
.AutoFitBehavior Behavior:=wdAutoFitFixed
.Columns.PreferredWidthType = wdPreferredWidthPoints
.Columns(1).PreferredWidth = InchesToPoints(1#)
.Columns(2).PreferredWidth = InchesToPoints(0.69)
.Columns(3).PreferredWidth = InchesToPoints(0.63)
.Columns(4).PreferredWidth = InchesToPoints(3#)
End If
End With
Next oTbl
End Sub