Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Macro: Select visible cells only

Right now my macro is creating a new worksheet for each name in a range.
However, i want my macro to create only a new worksheet for each VISIBLE name
in a range because I filter this list. Please help!!!!


Sub name_sheets()
'will add a sheet, and name it
'for each name in column C
'from C6 down till it hits a blank row
Dim Rng As Range
Dim ListRng As Range
Dim LRow As Long

Set ListRng = Range(Range("c6"), Range("c6").End(xlDown))
For Each Rng In ListRng
If Rng.Text < "" Then
With Worksheets
.Add(after:=.Item(.Count)).Name = Rng.Text
End With
End If
Next Rng
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default Macro: Select visible cells only

Set ListRng = Range(Range("c6"),
Range("c6").End(xlDown)).SpecialCells(xlCellTypeVi sible)

Regards

Trevor


"David T" wrote in message
...
Right now my macro is creating a new worksheet for each name in a range.
However, i want my macro to create only a new worksheet for each VISIBLE
name
in a range because I filter this list. Please help!!!!


Sub name_sheets()
'will add a sheet, and name it
'for each name in column C
'from C6 down till it hits a blank row
Dim Rng As Range
Dim ListRng As Range
Dim LRow As Long

Set ListRng = Range(Range("c6"), Range("c6").End(xlDown))
For Each Rng In ListRng
If Rng.Text < "" Then
With Worksheets
.Add(after:=.Item(.Count)).Name = Rng.Text
End With
End If
Next Rng
End Sub




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 272
Default Macro: Select visible cells only

Change This:
If Rng.Text < "" Then
To This:
If Rng.Text < "" And Not Rng.EntireRow.Hidden Then
--
Charles Chickering

"A good example is twice the value of good advice."


"David T" wrote:

Right now my macro is creating a new worksheet for each name in a range.
However, i want my macro to create only a new worksheet for each VISIBLE name
in a range because I filter this list. Please help!!!!


Sub name_sheets()
'will add a sheet, and name it
'for each name in column C
'from C6 down till it hits a blank row
Dim Rng As Range
Dim ListRng As Range
Dim LRow As Long

Set ListRng = Range(Range("c6"), Range("c6").End(xlDown))
For Each Rng In ListRng
If Rng.Text < "" Then
With Worksheets
.Add(after:=.Item(.Count)).Name = Rng.Text
End With
End If
Next Rng
End Sub


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
select only used rows and only visible cells Rokuro kubi Excel Discussion (Misc queries) 2 September 28th 06 02:06 PM
Select Visible Cells Only Apparently Excel Discussion (Misc queries) 2 January 29th 05 12:40 AM
Select visible cells using vba Tony Excel Programming 3 January 5th 05 03:35 PM
Trying to select the visible range of cells Selector Excel Programming 1 February 1st 04 08:40 PM
select visible cells when printing Richard Leclezio Excel Programming 0 October 1st 03 10:22 AM


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