Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-19-2016, 02:58 PM
AustinBrister AustinBrister is offline Take String of numbers, expand ranges, sort, then compress back into ranges Windows 7 64bit Take String of numbers, expand ranges, sort, then compress back into ranges Office 2013
Novice
Take String of numbers, expand ranges, sort, then compress back into ranges
 
Join Date: May 2015
Posts: 16
AustinBrister is on a distinguished road
Default Take String of numbers, expand ranges, sort, then compress back into ranges

Hello, I have quite the issue I am looking to resolve. I've been searching all over the internet now for at least 3 hours with no luck.



I have a word document with thousands of little areas with seemingly random messes of numbers, such as this:

Code:
11, 14, 35-37, 39-41, 49-51, 57-58, 63-64, 66, 68, 73-78, 82-87, 96, 114, 123, 17, 20-23, 25, 42, 56, 69-71, 89-91, 124, 17, 22-23, 56, 70, 89-91, 124, 20-21, 42, 69, 71, 25, 16, 18-19, 26-29, 32, 52, 72, 125, 43, 46, 53, 54, 59-62, 88, 93-94, 92, 116, 121, 122
I need to create VBA code that will allow me to take each of those little lists, expand those ranges (i.e., "39-41" would become separate entries of "39, 40, 41"), sort the list, then compress back into number ranges, where applicable.

Ideally I would just be able to select the numbers and fire the macro. I have found alphabetical sorting options, but I need numerical sorting.

Thanks in advance!!
Reply With Quote
 



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 01:22 AM.


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