I have tried the following code to apply Table Style within the same Workbook, and it works fine:
However, when I am trying to apply the same style to a table in a different Workbook, it's not working. This is the code I am using:
...where sPath is the path to the workbook that contains the style. So basically I am trying to change the style of all tables in any workbook using the style in that one workbook. It is giving me the Runtime error 9: Subscript out of range with the above code. I have also tried merging the styles but it does not work either. Probably because this is a Table Style and not a Cell Style.
Code:
ActiveSheet.ListObjects(ActiveCell.ListObject.Name).TableStyle = "Table Style 1"
However, when I am trying to apply the same style to a table in a different Workbook, it's not working. This is the code I am using:
Code:
ActiveSheet.ListObjects(ActiveCell.ListObject.Name).TableSty*le = Workbooks(sPath & "Table Style 1")
...where sPath is the path to the workbook that contains the style. So basically I am trying to change the style of all tables in any workbook using the style in that one workbook. It is giving me the Runtime error 9: Subscript out of range with the above code. I have also tried merging the styles but it does not work either. Probably because this is a Table Style and not a Cell Style.