I have a Leave Chart that is used by many people, which has filters on the Name and Department Columns. In order to ensure that all Filters are cancelled, I have this code, called in the workbook open event:
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o> </o>
Sub unfilter()<o></o>
On Error Resume Next<o></o>
Dim wrksht As Worksheet<o></o>
For Each wrksht In ThisWorkbook.Worksheets<o></o>
wrksht.ShowAllData<o></o>
Next wrksht<o></o>
End Sub
<o> </o>
I also have some code to ensure that worksheets are scrolled fully top-left when activated:
<o> </o>
With ActiveWindow<o></o>
.ScrollRow = 1<o></o>
.ScrollColumn = 1<o></o>
End With
<o> </o>
The problem is that this will apply whenever the worksheet is activated, which can be annoying if someone is browsing through the workbook. What I want to do is combine the two. I have tried:
<o> </o>
Sub unfilter()<o></o>
On Error Resume Next<o></o>
Dim wrksht As Worksheet<o></o>
For Each wrksht In ThisWorkbook.Worksheets<o></o>
wrksht.ShowAllData<o></o>
wrksht.ScrollRow = 1<o></o>
wrksht.ScrollColumn = 1<o></o>
Next wrksht<o></o>
End Sub
<o> </o>
but I get a compile error. Does anyone know how to solve this?
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o> </o>
Sub unfilter()<o></o>
On Error Resume Next<o></o>
Dim wrksht As Worksheet<o></o>
For Each wrksht In ThisWorkbook.Worksheets<o></o>
wrksht.ShowAllData<o></o>
Next wrksht<o></o>
End Sub
<o> </o>
I also have some code to ensure that worksheets are scrolled fully top-left when activated:
<o> </o>
With ActiveWindow<o></o>
.ScrollRow = 1<o></o>
.ScrollColumn = 1<o></o>
End With
<o> </o>
The problem is that this will apply whenever the worksheet is activated, which can be annoying if someone is browsing through the workbook. What I want to do is combine the two. I have tried:
<o> </o>
Sub unfilter()<o></o>
On Error Resume Next<o></o>
Dim wrksht As Worksheet<o></o>
For Each wrksht In ThisWorkbook.Worksheets<o></o>
wrksht.ShowAllData<o></o>
wrksht.ScrollRow = 1<o></o>
wrksht.ScrollColumn = 1<o></o>
Next wrksht<o></o>
End Sub
<o> </o>
but I get a compile error. Does anyone know how to solve this?