Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,533
- Office Version
- 365
- 2016
- Platform
- Windows
Hi Everyone.
I'm having a hard time with the code below. It is designed to check several worksheets to see if that worksheet data is being influenced by an advanced filter, and if it is, to cancel it and display all the data. Once displayed it will delete Rows 2-6000 of that sheet. (purging data)
I am receiving compile errors "Expected: End of statement" with the "THEN" after Filtermode, and compile errors "Expected: expression" after .End
Thanks in advance.
Jenn
I'm having a hard time with the code below. It is designed to check several worksheets to see if that worksheet data is being influenced by an advanced filter, and if it is, to cancel it and display all the data. Once displayed it will delete Rows 2-6000 of that sheet. (purging data)
I am receiving compile errors "Expected: End of statement" with the "THEN" after Filtermode, and compile errors "Expected: expression" after .End
Code:
With Workbooks("Rental_Main.xls")
.With Worksheets("Diamonds_Regular")
.if FilterMode [color=red]then[/color] ShowAllData
.Range("A2:K6000").Delete
.End [color=red]With[/color]
.With Worksheets("Diamonds_Tournament")
.if FilterMode [color=red]then[/color] ShowAllData
.Range("A2:K6000").Delete
.End [color=red]With[/color]
.WithWorksheets ("Fields_Regular")
.if FilterMode [color=red]then[/color] ShowAllData
.Range("A2:K6000").Delete
.End [color=red]With[/color]
.With Worksheets("Fields_Tournament")
.if FilterMode [color=red]then[/color] ShowAllData
.Range("A2:K6000").Delete
.End [color=red]With[/color]
.With Worksheets("Courts_Regular")
.if FilterMode [color=red]then[/color] ShowAllData
.Range("A2:K6000").Delete
.End [color=red]With[/color]
.With Worksheets("Courts_Tournament")
.if FilterMode [color=red]then[/color] ShowAllData
.Range("A2:K6000").Delete
.End [color=red]With[/color]
End With
Thanks in advance.
Jenn