Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sort Multiple Sheets by Category


Hey, I was wondering if you Excel Gurus could give me a hand. My mother
is making a list (in Excel) of all of the books in the church library.
The church would like to see each book sorted by titles on a tab for
each letter of the alphabet. So, she has created a workbook with 26
worksheets, each one is labeled with the letter of the alphabet (A, B,
C, etc). On each sheet, the Title is in Column A, the Author is in
Column B, and the Book Categoy is in Column C.

Is there a function that can be written to go through each sheet (A -
Z), and sort the data on a summary sheet (a 27th tab) by the Category
(Column C of each sheet)?

If this is possible, I'd love to see how. My Excel programming
knowledge is just enough that I know this could be done, but I am not
sure how to work it.


--
nmccart
------------------------------------------------------------------------
nmccart's Profile: http://www.excelforum.com/member.php...o&userid=35870
View this thread: http://www.excelforum.com/showthread...hreadid=556622

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Sort Multiple Sheets by Category

First, don't do it.

Apply Data|Filter|Autofilter to that range.

You can use a custom filter (begins with) to show the letters you want. You
could even use another column and extract the first character of the cell:

=left(a2,1)
(for example).

You're life will be much easier if you keep all your data in one single
location.

=========
But if you want...

You may want to look at the way Ron de Bruin and Debra Dalgleish approached it:

Ron de Bruin's EasyFilter addin:
http://www.rondebruin.nl/easyfilter.htm

Code from Debra Dalgleish's site:
http://www.contextures.com/excelfiles.html

Create New Sheets from Filtered List -- uses an Advanced Filter to create
separate sheet of orders for each sales rep visible in a filtered list; macro
automates the filter. AdvFilterRepFiltered.xls 35 kb

Update Sheets from Master -- uses an Advanced Filter to send data from
Master sheet to individual worksheets -- replaces old data with current.
AdvFilterCity.xls 55 kb

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

nmccart wrote:

Hey, I was wondering if you Excel Gurus could give me a hand. My mother
is making a list (in Excel) of all of the books in the church library.
The church would like to see each book sorted by titles on a tab for
each letter of the alphabet. So, she has created a workbook with 26
worksheets, each one is labeled with the letter of the alphabet (A, B,
C, etc). On each sheet, the Title is in Column A, the Author is in
Column B, and the Book Categoy is in Column C.

Is there a function that can be written to go through each sheet (A -
Z), and sort the data on a summary sheet (a 27th tab) by the Category
(Column C of each sheet)?

If this is possible, I'd love to see how. My Excel programming
knowledge is just enough that I know this could be done, but I am not
sure how to work it.

--
nmccart
------------------------------------------------------------------------
nmccart's Profile: http://www.excelforum.com/member.php...o&userid=35870
View this thread: http://www.excelforum.com/showthread...hreadid=556622


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sort Multiple Sheets by Category


If you want a quick solution, here's a brute force macro that should do
the trick (it doesn't do an alphabetical sort - it just dumps
everything that starts with "A" into sheet "A", and so forth, so
perform a sort first):

Sub SortCategories()
'Takes values from Range A, B, & C of "Summary Sheet" and
'sorts them alphabetically onto sheets labeled "A", "B",....
'NOTE: Runs down column A of "summary sheet" until it
'encounters an empty cell, then stops.

'Assumes:
'Title is in Column A, the Author is in Column B, and Category is
in Column C.
'Worksheet with unsorted data is called "Summary Sheet"
Dim i As Long, j As Long
Dim SummarySh As Worksheet
Dim PasteSh As Worksheet
Dim StRow As Integer
Dim PasteRow As Long

'Change StRow to the number of the first row containing data
StRow = 2
'Change "Summary sheet" to the name of the workbook with data
Set SummarySh = ActiveWorkbook.Worksheets("Summary Sheet")
i = StRow
For i = 1 To 26
Sheets(ColumnLetter(i)).Range("A1").Value = "Title"
Sheets(ColumnLetter(i)).Range("B1").Value = "Author"
Sheets(ColumnLetter(i)).Range("C1").Value = "Category"
Next i
Do While (SummarySh.Range("A" & i).Value < "")
Set PasteSh = Sheets(Left(SummarySh.Range("A" & i).Value, 1))
MsgBox PasteSh.Name
PasteRow = PasteSh.Range("A1").End(xlDown).Row + 1
If PasteRow = 65537 Then PasteRow = 2
PasteSh.Range("A" & PasteRow) = SummarySh.Range("A" & i)
PasteSh.Range("B" & PasteRow) = SummarySh.Range("B" & i)
PasteSh.Range("C" & PasteRow) = SummarySh.Range("C" & i)
i = i + 1
Loop

End Sub

Function ColumnLetter(ByVal ColumnNumber As Integer) As String
If ColumnNumber 26 Then
ColumnLetter = Chr(Int((ColumnNumber - 1) / 26) + 64) &
Chr(((ColumnNumber - 1) Mod 26) + 65)
Else
ColumnLetter = Chr(ColumnNumber + 64)
End If
End Function


--
SudokuKing
------------------------------------------------------------------------
SudokuKing's Profile: http://www.excelforum.com/member.php...o&userid=35868
View this thread: http://www.excelforum.com/showthread...hreadid=556622

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 sort multiple sheets (which have same format) at one time? Crickett Excel Discussion (Misc queries) 2 April 3rd 23 04:32 PM
How do I data sort multiple sheets in Excel that are linked with i yojlem Excel Worksheet Functions 2 January 11th 22 11:10 AM
Charting multiple values per category [email protected] Charts and Charting in Excel 3 December 24th 08 04:26 AM
Y-asix category with Multiple X-axis values Trouvera52 Charts and Charting in Excel 4 February 7th 07 10:51 PM
Alignment of Multiple-Level Category Labels Not Possible? MCP Charts and Charting in Excel 1 March 26th 05 07:01 AM


All times are GMT +1. The time now is 09:55 AM.

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"