Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Sorting Problem Need

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Sorting Problem Need

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Sorting Problem Need

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 176
Default Sorting Problem Need

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Sorting Problem Need

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 176
Default Sorting Problem Need

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Sorting Problem Need

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
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
Sorting problem JM Excel Worksheet Functions 2 October 21st 07 03:09 PM
sorting problem [email protected] Excel Discussion (Misc queries) 2 April 12th 07 06:01 PM
Sorting Problem sfar007 Excel Discussion (Misc queries) 2 June 28th 06 01:07 PM
Sorting problem Patrick Simonds Excel Discussion (Misc queries) 1 March 16th 05 03:43 PM
Sorting problem elayem[_2_] Excel Programming 0 October 15th 04 07:46 PM


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