Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Hide column if particular cell is NOT a certain value

Hi,

The following code is based on one I got from this forum. It hides all
columns in my worksheet from AG:IV if the value in row 37 is "Attendance". I
really need the flip side of this procedure as well, though, i.e., to hide
all columns from AG:IV if the value in row 37 is anything OTHER than
"Attendance". Can anyone help?

For a = 32 To 255
If Range("a37").Offset(0, a).Value = "Attendance" Then
Range("a37").Offset(0, a).EntireColumn.Hidden = True
Next a

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Hide column if particular cell is NOT a certain value

it should work if you change the = "Attendance" to < "Attendance"

--


Gary


"Invoice" wrote in message
...
Hi,

The following code is based on one I got from this forum. It hides all
columns in my worksheet from AG:IV if the value in row 37 is "Attendance". I
really need the flip side of this procedure as well, though, i.e., to hide
all columns from AG:IV if the value in row 37 is anything OTHER than
"Attendance". Can anyone help?

For a = 32 To 255
If Range("a37").Offset(0, a).Value = "Attendance" Then
Range("a37").Offset(0, a).EntireColumn.Hidden = True
Next a



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Hide column if particular cell is NOT a certain value

Thanks, Gary. Now, if you don't mind helping out some more, I still have a
problem with this code and that is that whenever I enter the AG:IV range, the
hidden columns reappear.

"Gary Keramidas" wrote:

it should work if you change the = "Attendance" to < "Attendance"

--


Gary


"Invoice" wrote in message
...
Hi,

The following code is based on one I got from this forum. It hides all
columns in my worksheet from AG:IV if the value in row 37 is "Attendance". I
really need the flip side of this procedure as well, though, i.e., to hide
all columns from AG:IV if the value in row 37 is anything OTHER than
"Attendance". Can anyone help?

For a = 32 To 255
If Range("a37").Offset(0, a).Value = "Attendance" Then
Range("a37").Offset(0, a).EntireColumn.Hidden = True
Next a




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Hide column if particular cell is NOT a certain value

not sure what you mean. can you give an example? when does it become
visible? there must be something unhiding it.

--


Gary Keramidas


"Invoice" wrote in message
...
Thanks, Gary. Now, if you don't mind helping out some more, I still have a
problem with this code and that is that whenever I enter the AG:IV range,
the
hidden columns reappear.

"Gary Keramidas" wrote:

it should work if you change the = "Attendance" to < "Attendance"

--


Gary


"Invoice" wrote in message
...
Hi,

The following code is based on one I got from this forum. It hides all
columns in my worksheet from AG:IV if the value in row 37 is
"Attendance". I
really need the flip side of this procedure as well, though, i.e., to
hide
all columns from AG:IV if the value in row 37 is anything OTHER than
"Attendance". Can anyone help?

For a = 32 To 255
If Range("a37").Offset(0, a).Value = "Attendance" Then
Range("a37").Offset(0, a).EntireColumn.Hidden = True
Next a





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Hide column if particular cell is NOT a certain value

Yes, I think you're right. I noticed that I have the following code in my
worksheet which may be unhiding it. Is there any way to keep this and the
other w/o loss of functionality?

[code]
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
Application.ScreenUpdating = False
If Intersect(Target, Range("AI:IV")) Is Nothing Then
Columns("AI:IV").ColumnWidth = 5
Else
Columns("AI:IV").ColumnWidth = 5
Target.Columns.ColumnWidth = 20
End If
End Sub


"GKeramidas" wrote:

not sure what you mean. can you give an example? when does it become
visible? there must be something unhiding it.

--


Gary Keramidas


"Invoice" wrote in message
...
Thanks, Gary. Now, if you don't mind helping out some more, I still have a
problem with this code and that is that whenever I enter the AG:IV range,
the
hidden columns reappear.

"Gary Keramidas" wrote:

it should work if you change the = "Attendance" to < "Attendance"

--


Gary


"Invoice" wrote in message
...
Hi,

The following code is based on one I got from this forum. It hides all
columns in my worksheet from AG:IV if the value in row 37 is
"Attendance". I
really need the flip side of this procedure as well, though, i.e., to
hide
all columns from AG:IV if the value in row 37 is anything OTHER than
"Attendance". Can anyone help?

For a = 32 To 255
If Range("a37").Offset(0, a).Value = "Attendance" Then
Range("a37").Offset(0, a).EntireColumn.Hidden = True
Next a





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
Hide or Unhide Column Based on Cell Value windsurferLA Excel Programming 2 March 31st 06 11:06 PM
Hide column or row based on a cell in the column or row? SacGuy Excel Discussion (Misc queries) 0 January 24th 06 06:51 PM
Hide Cell Row and column number alexm999 Excel Discussion (Misc queries) 1 December 1st 05 02:29 PM
Hide Column - With text in cell O&O Excel Programming 5 November 9th 05 01:07 PM
How to hide a column once any cell of that col. is not active any Frederic Excel Programming 1 May 25th 05 02:21 PM


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