Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Hiding columns whilst autofiltered - PART 2 HELP!!!

Hi,

I'm a teacher and have a mark book which I filter by class (Column C, rows 2
down) . I fill in data in other columns, but not every column necessarily,
however, every column does have a date in row 1, and lesson objective in row
2.

Is there a way to use autofilter to just select the class, but then only
show columns with data in, and hide the rest.

For instance, when I filter one class, only rows 29 to 61 are on show. I
then have data in columns F and G, whilst D and E are blank for this class.
I'd like these columns to be hidden for this class, and if I selected another
class, then whatever columns are blank for them to be hidden.

If you do have any hints, that'd be fantastic!!!

Paul.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Hiding columns whilst autofiltered - PART 2 HELP!!!

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

--
Regards,
Tom Ogilvy



"PG Oriel" wrote in message
...
Hi,

I'm a teacher and have a mark book which I filter by class (Column C, rows
2
down) . I fill in data in other columns, but not every column necessarily,
however, every column does have a date in row 1, and lesson objective in
row
2.

Is there a way to use autofilter to just select the class, but then only
show columns with data in, and hide the rest.

For instance, when I filter one class, only rows 29 to 61 are on show. I
then have data in columns F and G, whilst D and E are blank for this
class.
I'd like these columns to be hidden for this class, and if I selected
another
class, then whatever columns are blank for them to be hidden.

If you do have any hints, that'd be fantastic!!!

Paul.



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
Hiding part of VBA or a Module in Macro Iraj Excel Discussion (Misc queries) 3 March 23rd 12 11:47 AM
Link PivotChart to PivotTable, whilst hiding fields clifgriffin Excel Discussion (Misc queries) 0 March 3rd 09 07:03 PM
Hiding blank columns when autofiltered? PG Oriel Excel Programming 3 October 10th 06 02:37 PM
Getting Excel whilst using the sumif formula to search for part of a word Newbie81 Excel Discussion (Misc queries) 1 December 20th 05 01:56 PM
Hiding Part of the VBA Code Matt Excel Programming 5 June 7th 04 07:07 PM


All times are GMT +1. The time now is 01:34 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"