Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 07-19-2016, 04:44 PM
Guessed's Avatar
Guessed Guessed is offline Take String of numbers, expand ranges, sort, then compress back into ranges Windows 10 Take String of numbers, expand ranges, sort, then compress back into ranges Office 2013
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

And what do you want to do if the same page number appears twice?

I don't have the excitement levels to code this at present but would approach this in the following way:
Replace all spaces with nothing
Split into an array
Loop the array to convert the dashes into a series of numbers separated by commas
Convert the array back into a string separated by commas
Split into an array a second time and do a bubblesort to arrange them in ascending order
Convert the final array back into a string separated by commas

You could remove a couple of steps if you converted the initial string into an ado.recordset which simplifies the sorting requirement.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Take String of numbers, expand ranges, sort, then compress back into ranges Dynamic chart ranges GlowingApple Excel 1 02-17-2016 07:18 PM
Take String of numbers, expand ranges, sort, then compress back into ranges Problem with have a chart with different data ranges expert4knowledge Excel 2 09-09-2014 06:27 AM
Take String of numbers, expand ranges, sort, then compress back into ranges Compare content of two ranges INCLUDING FORMATTING delasson Word VBA 3 12-10-2012 03:54 AM
How to use named ranges in excel vba? bosve73 Excel Programming 4 01-25-2012 09:26 AM
Dynamic Named Ranges using text hannu Excel 0 06-22-2010 04:42 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:50 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft