LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default Want to blank some cells when an AutoFilter is active.

I have a budget table that has a Allocated budget amount, Expenses and a
remaining balance:

Allocated Expenses Remaining
Budget Subtotal Balance
-----------------------------------------
$500.00 $300.00 $200.00

The Expense Subtotal is a sum of column of values below this header say
H30:H100. The Subtotal is of the rows that are visible so say there are two
values, $100.00 and $200.00 and $100.00 is hidden by an autofilter. Then
Subtotal will become $200.00. If an auto filter is active I want to blank the
Remaining Balance field.

I have a function that will return a string 'true' if an autofilter is active:

Function MyFilters() As String

Dim i As Integer
Dim rng As Range

'Debug.Print "- MyFilters: " & Err.Number
On Error GoTo ErrThisFun
MyFilters = False
With ActiveSheet.AutoFilter
'Debug.Print "-- MyFilters: Auto:" & .Range.Address
For i = 1 To .Range.Columns.Count
With .Filters(i)
If .On Then
MyFilters = True
End If
End With
Next
End With
GoTo ExitFun

ErrThisFun:
'Debug.Print "-- MyFilters: ERR: " & Err.Number
Resume ExitFun

ExitFun:
'Debug.Print "<- MyFilters: " & Err.Number

End Function

Of course, this function could return a boolean.

How can I use this function to blank the Remaining Balance cells? I tried
making it a UDF and adding Application.Volatile and Public, but that causes
another unrelated macro that modifies other cells to fail with RunTime Error
1004. Anything that runs the MyFilters causes the other macros to fail.

Any ideas?
John S.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy data when Autofilter On and active sebastien Excel Programming 0 December 19th 08 12:41 AM
Autofilter on non-active sheet tigger Excel Programming 5 November 5th 07 11:22 AM
Ignore Blank Cells on AutoFilter GrandMaMa Excel Programming 0 July 6th 07 04:34 PM
Autofilter a list of numbers and blank cells Cheryl Excel Discussion (Misc queries) 3 June 22nd 06 04:50 PM
autofilter on a not-active sheet Peter[_21_] Excel Programming 2 January 15th 05 12:33 PM


All times are GMT +1. The time now is 11:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"