Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Whats happened?

Hi, the code below used to update the hidden columns after I pressed the
autofilter button. It has now changed and I have to click in a column before
it updates. Any thoughts as to why or how I can get it autoupdate when I use
the autofilter drop-down?

Sub ABC()
Dim lastColumn As Long, rngA As Range, i As Long
Dim rng1 As Range
Application.ScreenUpdating = False
Columns.Hidden = False
lastColumn = Me.Cells(1, "IV").End(xlToLeft).Column
Set rngA = Me.AutoFilter.Range
Set rngA = rngA.Offset(1, 0) _
.Resize(rngA.Rows.Count - 1, 1)
For i = 5 To lastColumn
Set rng1 = Cells(3, i).Resize(rngA.Rows.Count, 1)
If Application.Subtotal(3, rng1) = 0 Then
Columns(i).Hidden = True
End If
Next
Application.ScreenUpdating = True
End Sub

Private Sub Worksheet_Calculate()
If Me.AutoFilterMode Then
ABC
Else
Columns.Hidden = False
End If
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Me.AutoFilterMode Then
ABC
Else
Columns.Hidden = False
End If
End Sub
Reply
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
What happened to m.p.excel? JoeU2004 Excel Discussion (Misc queries) 2 May 12th 09 09:12 AM
Now what happened? Jim1812 Excel Discussion (Misc queries) 5 November 10th 08 04:41 PM
what happened linda Excel Worksheet Functions 1 August 6th 07 10:26 PM
what happened WYN Excel Discussion (Misc queries) 1 October 11th 06 06:39 PM
What happened to Excel? carrotops Setting up and Configuration of Excel 1 February 5th 06 01:49 PM


All times are GMT +1. The time now is 12:32 AM.

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

About Us

"It's about Microsoft Excel"