Question : Loop through to remove all table styles

Can anyone help make this work, i am trying to loop through each sheet in the workbook, and on each sheet loop through each table and remove the table style.  I am using excel 2007

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
Sub TryThis()
Dim oSh As Worksheet
Dim oLo As ListObject
Dim oWb As Workbook

Set oWb = ActiveWorkbook

For Each oSh In oWb
    oSh.Activate
        For Each oLo In oSh
            ActiveSheet.ListObjects(oLo).TableStyle = ""
        Next oLo
Next oSh

End Sub


On the line "For Each oSh in oWb" i get an error saying Object doesnt support this property or method

Answer : Loop through to remove all table styles

You need to set up the enumeration this way:

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
Sub TryThis()
Dim oSh As Worksheet
Dim oLo As ListObject
Dim oWb As Workbook

Set oWb = ActiveWorkbook

For Each oSh In oWb.Worksheets
    For Each oLo In oSh.ListObjects
        oLo.TableStyle = ""
    Next oLo
Next oSh

End Sub
Random Solutions  
 
programming4us programming4us