Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
I have a Customer File record recorded on a sheet that spreads across columns A thru M but the amount of rows a single record may take up can very somewhat from say 2 rows to 6 rows its always different depending on the size of the record Coolum F contains a postal zip code that I would like to use to sort the record by. Each record begins in column A with the same exact word 'Contact' and I thought this would be a way to determine the start of a new record which in turn would determine the length of the number of rows of the previous record so to keep the complete record together during the sort. The total numbers rows the code should cover are all or all rows with information in them and I believe this is needed criteria. I hope I have explained everything clearly without overstating what is needed. Example: Contact John Doe 234 hope st Ontario CA 91784 213 266-5487 Product F65A 2/5/05 SFO 3/1504 This sort of programming is way over my head so could someone please help if this is even possible |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
James,
Excel has a sort feature. Have you tried it? "James" wrote in message ... Hello, I have a Customer File record recorded on a sheet that spreads across columns A thru M but the amount of rows a single record may take up can very somewhat from say 2 rows to 6 rows its always different depending on the size of the record Coolum F contains a postal zip code that I would like to use to sort the record by. Each record begins in column A with the same exact word 'Contact' and I thought this would be a way to determine the start of a new record which in turn would determine the length of the number of rows of the previous record so to keep the complete record together during the sort. The total numbers rows the code should cover are all or all rows with information in them and I believe this is needed criteria. I hope I have explained everything clearly without overstating what is needed. Example: Contact John Doe 234 hope st Ontario CA 91784 213 266-5487 Product F65A 2/5/05 SFO 3/1504 This sort of programming is way over my head so could someone please help if this is even possible |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
Yes but the built in sort feature will not allow for the variable I have in each record with respect to the number of rows each record may have James "Charles Harmon" wrote in message ... James, Excel has a sort feature. Have you tried it? "James" wrote in message ... Hello, I have a Customer File record recorded on a sheet that spreads across columns A thru M but the amount of rows a single record may take up can very somewhat from say 2 rows to 6 rows its always different depending on the size of the record Coolum F contains a postal zip code that I would like to use to sort the record by. Each record begins in column A with the same exact word 'Contact' and I thought this would be a way to determine the start of a new record which in turn would determine the length of the number of rows of the previous record so to keep the complete record together during the sort. The total numbers rows the code should cover are all or all rows with information in them and I believe this is needed criteria. I hope I have explained everything clearly without overstating what is needed. Example: Contact John Doe 234 hope st Ontario CA 91784 213 266-5487 Product F65A 2/5/05 SFO 3/1504 This sort of programming is way over my head so could someone please help if this is even possible |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This should be a good start.
It adds two columns for sorting. Sub sub1() Dim zRow&, zCol%, iRow&, tmpZip$ tmpZip = "00000" zRow = UsedRange.SpecialCells(xlCellTypeLastCell).Row zCol = UsedRange.SpecialCells(xlCellTypeLastCell).Column For iRow = 1 To zRow If Cells(iRow, 1) = "Contact" Then tmpZip = Cells(iRow, 6) Cells(iRow, zCol + 1) = tmpZip Cells(iRow, zCol + 2) = iRow Next iRow Range("a1", Cells(zRow, zCol + 2)).Sort _ key1:=Cells(1, zCol + 1), key2:=Cells(1, zCol + 2) End Sub James wrote: I have a Customer File record recorded on a sheet that spreads across columns A thru M but the amount of rows a single record may take up can very somewhat from say 2 rows to 6 rows its always different depending on the size of the record Coolum F contains a postal zip code that I would like to use to sort the record by. Each record begins in column A with the same exact word 'Contact' and I thought this would be a way to determine the start of a new record which in turn would determine the length of the number of rows of the previous record so to keep the complete record together during the sort. The total numbers rows the code should cover are all or all rows with information in them and I believe this is needed criteria. I hope I have explained everything clearly without overstating what is needed. Example: Contact John Doe 234 hope st Ontario CA 91784 213 266-5487 Product F65A 2/5/05 SFO 3/1504 This sort of programming is way over my head so could someone please help if this is even possible ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups ----= East and West-Coast Server Farms - Total Privacy via Encryption =---- |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for the help but having problem with the line yyou worte
zRow = UsedRange.SpecialCells(xlCellTypeLastCell).Row seems it come back with a object required error thanks James "Dave D-C" wrote in message ... This should be a good start. It adds two columns for sorting. Sub sub1() Dim zRow&, zCol%, iRow&, tmpZip$ tmpZip = "00000" zRow = UsedRange.SpecialCells(xlCellTypeLastCell).Row zCol = UsedRange.SpecialCells(xlCellTypeLastCell).Column For iRow = 1 To zRow If Cells(iRow, 1) = "Contact" Then tmpZip = Cells(iRow, 6) Cells(iRow, zCol + 1) = tmpZip Cells(iRow, zCol + 2) = iRow Next iRow Range("a1", Cells(zRow, zCol + 2)).Sort _ key1:=Cells(1, zCol + 1), key2:=Cells(1, zCol + 2) End Sub James wrote: I have a Customer File record recorded on a sheet that spreads across columns A thru M but the amount of rows a single record may take up can very somewhat from say 2 rows to 6 rows its always different depending on the size of the record Coolum F contains a postal zip code that I would like to use to sort the record by. Each record begins in column A with the same exact word 'Contact' and I thought this would be a way to determine the start of a new record which in turn would determine the length of the number of rows of the previous record so to keep the complete record together during the sort. The total numbers rows the code should cover are all or all rows with information in them and I believe this is needed criteria. I hope I have explained everything clearly without overstating what is needed. Example: Contact John Doe 234 hope st Ontario CA 91784 213 266-5487 Product F65A 2/5/05 SFO 3/1504 This sort of programming is way over my head so could someone please help if this is even possible ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups ----= East and West-Coast Server Farms - Total Privacy via Encryption =---- |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hm. Works on my XL97
Try zRow = ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastC ell).Row James wrote: Thanks for the help but having problem with the line yyou worte zRow = UsedRange.SpecialCells(xlCellTypeLastCell).Row seems it come back with a object required error ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups ----= East and West-Coast Server Farms - Total Privacy via Encryption =---- |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Dave,
Thanks that did the trick, appriciate the help James "Dave D-C" wrote in message ... Hm. Works on my XL97 Try zRow = ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastC ell).Row James wrote: Thanks for the help but having problem with the line yyou worte zRow = UsedRange.SpecialCells(xlCellTypeLastCell).Row seems it come back with a object required error ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups ----= East and West-Coast Server Farms - Total Privacy via Encryption =---- |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Sorting problem | Excel Worksheet Functions | |||
sorting problem | Excel Discussion (Misc queries) | |||
Sorting Problem | Excel Discussion (Misc queries) | |||
Sorting problem | Excel Discussion (Misc queries) | |||
Sorting problem | Excel Programming |