PC Review


Reply
Thread Tools Rate Thread

Create Range of Visible Rows only

 
 
Humphrey
Guest
Posts: n/a
 
      18th Mar 2010
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 With Quote
 
 
 
 
JLGWhiz
Guest
Posts: n/a
 
      18th Mar 2010
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" <(E-Mail Removed)> wrote in message
news:3A5BDB80-E472-472F-9ECB-(E-Mail Removed)...
>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 With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      18th Mar 2010
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" <(E-Mail Removed)> wrote in message
news:3A5BDB80-E472-472F-9ECB-(E-Mail Removed)...
>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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
need a macro to set the print range only for visible rows vicky Microsoft Excel Programming 1 12th Jul 2010 02:41 PM
How to select Visible Cells range minus 2 rows (frozen panes) =?Utf-8?B?THVpc0U=?= Microsoft Excel Programming 5 22nd Nov 2007 05:01 AM
Dynamically create range of rows Avi Dubnikov Microsoft Excel Misc 2 25th Aug 2007 02:00 AM
VBA (or Excel) crashes if Count of Visible Rows in Autofilter Range = 1 EagleOne@discussions.microsoft.com Microsoft Excel Programming 2 1st Jul 2007 03:08 AM
Can I create a macro to identify and delete blank rows in a range? =?Utf-8?B?Y2FybHNvbmRq?= Microsoft Excel Programming 7 10th Jun 2005 12:38 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:34 AM.