Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Create Range of Visible Rows only

I would like to create a range containing only the visible rows in columns
A:N. I can filter the list and then create a range but it selects all the
hidden rows as well. Is there a way to restrict the range to just the
visible rows?

H
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Create Range of Visible Rows only

Assume the range is A1:C25

Sub testVis()
Dim rng As Range, c As Range
Set rng = ActiveSheet.Range("A1:C25")
For Each c In rng.SpecialCells(xlCellTypeVisible)
If c.Row.Hidden = True Then
MsgBox "Not Working"
Else
MsgBox "Working"
End If
Next
End Sub
You should get Working only when the macro runs.


"Humphrey" wrote in message
...
I would like to create a range containing only the visible rows in columns
A:N. I can filter the list and then create a range but it selects all the
hidden rows as well. Is there a way to restrict the range to just the
visible rows?

H



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Create Range of Visible Rows only

Sorry Humphrey, left out a key word. Use this.

Sub testVis()
Dim rng As Range, c As Range
Set rng = ActiveSheet.Range("A1:C25")
For Each c In rng.SpecialCells(xlCellTypeVisible)
If Rows(c.Row).Hidden = True Then
MsgBox "Not Working"
Else
MsgBox "Working"
End If
Next
End Sub






"Humphrey" wrote in message
...
I would like to create a range containing only the visible rows in columns
A:N. I can filter the list and then create a range but it selects all the
hidden rows as well. Is there a way to restrict the range to just the
visible rows?

H



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
How to select Visible Cells range minus 2 rows (frozen panes) LuisE Excel Programming 5 November 22nd 07 05:01 AM
Dynamically create range of rows Avi Dubnikov Excel Discussion (Misc queries) 2 August 25th 07 02:00 AM
VBA (or Excel) crashes if Count of Visible Rows in Autofilter Range = 1 [email protected] Excel Programming 2 July 1st 07 03:08 AM
Macro to create a shortcut to make next Worksheet visible nde Excel Programming 3 March 5th 07 03:31 PM
Can I create a macro to identify and delete blank rows in a range? carlsondj Excel Programming 6 June 10th 05 12:38 AM


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