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 blank columns when autofiltered?

Hi,

I'm a teacher and have a mark book which I filter by class. I fill in data
in columns, but not every column necessarily, however, every column does have
a date in row 1.

Is there a way to use autofilter to just select the class, but then only
show columns with data in, and hide the rest. Obviously the date being in row
1 of every column might affect this??

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

Paul.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 324
Default Hiding blank columns when autofiltered?

After your autofilter this might be what you are looking for as long as A2
or another particular cell will always be filled on the active columns.

Sub test()
Range("A1").Activate ' or whichever column holds the class names.
Selection.AutoFilter Field:=1, Criteria1:="ClassName"

ActiveSheet.Range("A2").Activate
For x = 1 To 100

If ActiveCell = "" Then
Selection.EntireColumn.Hidden = True
Else
ActiveCell.Offset(0, 1).Activate
End If
If x 100 Then
Exit Sub
End If
Next x
End Sub


Columns("A:Z").select
Selection.EntireColumn.Hidden = False
' to make them visible for the next procedure.
--
Best wishes,

Jim


"PG Oriel" wrote:

Hi,

I'm a teacher and have a mark book which I filter by class. I fill in data
in columns, but not every column necessarily, however, every column does have
a date in row 1.

Is there a way to use autofilter to just select the class, but then only
show columns with data in, and hide the rest. Obviously the date being in row
1 of every column might affect this??

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

Paul.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Hiding blank columns when autofiltered?

I have been unable to get the programming below to work. Jim, could I email
you the spreadsheet so you could see it?? Thanks!!

"Jim Jackson" wrote:

After your autofilter this might be what you are looking for as long as A2
or another particular cell will always be filled on the active columns.

Sub test()
Range("A1").Activate ' or whichever column holds the class names.
Selection.AutoFilter Field:=1, Criteria1:="ClassName"

ActiveSheet.Range("A2").Activate
For x = 1 To 100

If ActiveCell = "" Then
Selection.EntireColumn.Hidden = True
Else
ActiveCell.Offset(0, 1).Activate
End If
If x 100 Then
Exit Sub
End If
Next x
End Sub


Columns("A:Z").select
Selection.EntireColumn.Hidden = False
' to make them visible for the next procedure.
--
Best wishes,

Jim


"PG Oriel" wrote:

Hi,

I'm a teacher and have a mark book which I filter by class. I fill in data
in columns, but not every column necessarily, however, every column does have
a date in row 1.

Is there a way to use autofilter to just select the class, but then only
show columns with data in, and hide the rest. Obviously the date being in row
1 of every column might affect this??

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

Paul.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 324
Default Hiding blank columns when autofiltered?

I would be glad for you to send it so I can see better what you need.
Send it to removing the (nospam) of course.
--
Best wishes,

Jim


"PG Oriel" wrote:

I have been unable to get the programming below to work. Jim, could I email
you the spreadsheet so you could see it?? Thanks!!

"Jim Jackson" wrote:

After your autofilter this might be what you are looking for as long as A2
or another particular cell will always be filled on the active columns.

Sub test()
Range("A1").Activate ' or whichever column holds the class names.
Selection.AutoFilter Field:=1, Criteria1:="ClassName"

ActiveSheet.Range("A2").Activate
For x = 1 To 100

If ActiveCell = "" Then
Selection.EntireColumn.Hidden = True
Else
ActiveCell.Offset(0, 1).Activate
End If
If x 100 Then
Exit Sub
End If
Next x
End Sub


Columns("A:Z").select
Selection.EntireColumn.Hidden = False
' to make them visible for the next procedure.
--
Best wishes,

Jim


"PG Oriel" wrote:

Hi,

I'm a teacher and have a mark book which I filter by class. I fill in data
in columns, but not every column necessarily, however, every column does have
a date in row 1.

Is there a way to use autofilter to just select the class, but then only
show columns with data in, and hide the rest. Obviously the date being in row
1 of every column might affect this??

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
auto hiding blank rows and columns Jase Excel Discussion (Misc queries) 5 October 29th 08 09:00 AM
Reverting all Autofiltered columns to "ALL" bollard Excel Discussion (Misc queries) 1 March 29th 07 12:48 PM
Hiding blank rows pkeegs Excel Programming 1 March 1st 06 04:15 AM
Remove blank rows without hiding them peter.thompson[_40_] Excel Programming 1 January 12th 06 09:38 PM
Hiding blank rows mlkpied Excel Discussion (Misc queries) 1 March 29th 05 08:57 PM


All times are GMT +1. The time now is 01:13 PM.

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"