Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have 2 rows of totals at the bottom of my database (separated from the DB
by an empty row). When filtering with AutoFilter, the totals rows will sometimes become hidden. I added the following procedure in my worksheet calculate event in an attemt to remedy this problem: Private Sub Worksheet_Calculate() 'Prevent Totals Row from being hidden when filtering On Error Resume Next If wshDatabase.Range("TotalsRows").EntireRow.Hidden = True Then wshDatabase.Range("TotalsRows").EntireRow.Hidden = False Exit Sub On Error GoTo 0 End If End Sub The problem is, this sub causes Excel to crash. Can someome recommend a better sub to keep the totals rows unhidden when filtering? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
An easy way is to not include the "totals" rows in the filter in the
first place. For example, if the header row is row#1 and the data is in rows#2-99 and row#100 is blank and row#101 contains the totals, then: Sub Macro2() Rows("1:99").Select Selection.AutoFilter End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Oct 6, 6:18*pm, "John" wrote:
I have 2 rows of totals at the bottom of my database (separated from the DB by an empty row). When filtering with AutoFilter, the totals rows will sometimes become hidden. I added the following procedure in my worksheet calculate event in an attemt to remedy this problem: Private Sub Worksheet_Calculate() * *'Prevent Totals Row from being hidden when filtering * * On Error Resume Next * * If wshDatabase.Range("TotalsRows").EntireRow.Hidden = True Then * * * * wshDatabase.Range("TotalsRows").EntireRow.Hidden = False * * * * Exit Sub * * On Error GoTo 0 * * End If *End Sub The problem is, this sub causes Excel to crash. Can someome recommend a better sub to keep the totals rows unhidden when filtering? Why not just have your autofilter exclude the last two rows |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
You will need to be more precise about the range you are filtering, so that the total rows are excluded. Then you won't need the worksheet_Calculate code. What is your code that does the filter? regards Paul On Oct 7, 12:18*am, "John" wrote: I have 2 rows of totals at the bottom of my database (separated from the DB by an empty row). When filtering with AutoFilter, the totals rows will sometimes become hidden. I added the following procedure in my worksheet calculate event in an attemt to remedy this problem: Private Sub Worksheet_Calculate() * *'Prevent Totals Row from being hidden when filtering * * On Error Resume Next * * If wshDatabase.Range("TotalsRows").EntireRow.Hidden = True Then * * * * wshDatabase.Range("TotalsRows").EntireRow.Hidden = False * * * * Exit Sub * * On Error GoTo 0 * * End If *End Sub The problem is, this sub causes Excel to crash. Can someome recommend a better sub to keep the totals rows unhidden when filtering? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Sorting data and Advance filtering to get totals on a spreadsheet | Excel Discussion (Misc queries) | |||
Filtering totals - Reps per Province | Excel Worksheet Functions | |||
Adding totals after filtering | Excel Discussion (Misc queries) | |||
Fast way to make rows visible and invisible | Excel Programming | |||
Filtering and Totals | Excel Discussion (Misc queries) |