LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,073
Default Help! How can I do this?

Hi Patrick,

I forgot to answer your question re supporting named ranges. My
experience with coding with named ranges is limited so I decided to
have a go. Here's the result...

Public Sub ListSoldTitles()
'This version relies on two named ranges on the
'sheet named "extended"...
'Name = "Titles" which refers to ALL of the book titles
'Name = "Sold" which refers to list of "Yes"/"No"
'You still need to edit the value of the string constant
'strDestination at the end of the next line
Const strDestination As String = "A" '<< edit to suit
Application.ScreenUpdating = False
With Worksheets("breakdown")
.Columns(strDestination).ClearContents
'Add 'Sold Titles' heading to breakdown sheet
.Cells(1, strDestination) = "Sold Titles"
End With
Dim I As Long
Dim J As Long
Dim rgCell As Range
For Each rgCell In Worksheets("extended").Range("Sold")
I = I + 1
If UCase(rgCell.Value) = "YES" Then
J = J + 1
Worksheets("breakdown").Cells(J + 1, strDestination).Value _
= Worksheets("extended").Range("Title").Cells(I, 1).Value
End If
Next rgCell
Worksheets("breakdown").Columns(strDestination).Au toFit
End Sub

How's that for code shrinkage:-)

WIth named ranges all the hard work is done by excel, rather than the
programmer.

I assume you are using dynamic named ranges. They certainly make life a
lot easier.

Ken Johnson

 
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



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