LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Autofiltered cells not "Hidden"

if mycell.entirerow.hidden = false then
'do your stuff
...
end if

Or you could look at just the visible cells in the selection

dim vRng as range
set vrng = nothing
on error resume next
set vrng = intersect(selection,selection.cells.specialcells(x lcelltypevisible)
on error goto 0

if vrng is nothing then
'no cells are visible!
else
for each mycell in vrng.cells
'do something
next mycell
end if

Lionel H wrote:

Having selected a number of cells, I use the following to process them:

Sub Demo1()
Dim myCell
For Each myCell In Selection
€˜Do some processing:
Debug.Print myCell.Value
Next myCell
End Sub

This works fine until I select cells across cells hidden by the autofilter
The above macro includes the cells hidden by the autofilter which I do not
want.
I amend my code as follows:

Sub Demo2()
Dim myCell
For Each myCell In Selection
If Not myCell.Hidden Then €˜this line fails €“ 1004 Unable to get the
Hidden property of the range class
€˜Do some processing:
Debug.Print myCell.Value
End If
Next myCell
End Sub

I have used debug watch on myCell and Selection and cannot find an
alternative way of skipping the autofiltered cells.
Can anyone help please?


--

Dave Peterson
 
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
Difficulty "countif"-ing number of "L1" or "L2" on an autofiltered pmdoherty Excel Worksheet Functions 4 February 6th 09 11:23 AM
Reverting all Autofiltered columns to "ALL" bollard Excel Discussion (Misc queries) 1 March 29th 07 12:48 PM
"ignoring" hidden cells in a copy/paste operation gvm Excel Discussion (Misc queries) 2 March 22nd 07 10:38 PM
Hi-Lite "empty" unlocked cells in non-hidden rows BEEJAY Excel Programming 4 March 14th 07 11:44 AM
Enter a "checkmark" in an AutoFiltered cell L Mehl Excel Programming 2 September 27th 04 12:30 AM


All times are GMT +1. The time now is 11:30 PM.

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"