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: 360
Default need an OR in the countif statement

This version does work better. Now it is counting on the columns and I can
see it in the msgbox. Before I think it wasn't counting any columns. It
still doesn't hide any columns though. The reason is there are blank's in
the data rows because there are subtotal rows on groups and those cells don't
have an n/a, so I need to know how to use the OR in the countif or else I
need to not use the countif. I tried
Application.CountIf(C.Cells, "n/A" or " ")
Application.CountIf(C.Cells, "n/a") OR Application.CountIf(C.Cells, " ")
(this last one was really scary, it caused all the n/a cells to be blank
instead of hiding them

tia,
----------------------------------------
Public Sub FORMAT_VOD_HideColumns()
Dim C As Range
Dim lr As Integer


lr = ActiveSheet.Cells(Rows.Count, 4).End(xlUp).Row
Application.ScreenUpdating = False

For Each C In Intersect(Range("12:" & lr), ActiveSheet.UsedRange).Columns
Application.ScreenUpdating = False

If Application.CountIf(C.Cells, "n/A") = C.Cells.Count Then
C.EntireColumn.Hidden = True
MsgBox C.Address
Else
C.EntireColumn.Hidden = False

End If

Next C


Application.ScreenUpdating = True

End Sub
 
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
Countif? or IF statement?? paankadu Excel Worksheet Functions 2 February 9th 09 05:50 PM
OR statement in a Countif Janis Excel Programming 7 August 22nd 07 11:20 PM
Countif within and if statement Amber Excel Worksheet Functions 2 July 30th 07 06:05 PM
countif statement italiavb Excel Worksheet Functions 4 July 14th 06 01:57 PM
countif statement Russell Hampton Excel Worksheet Functions 6 December 18th 04 07:39 PM


All times are GMT +1. The time now is 06:49 AM.

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"