Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 20
Default Expanding sequence of data

Please show me how to go from:
234-238 (in one cell) to: 234 235 236 237 238 (each in individual
cell).
My worksheet has so many of these numbers and can't use "FILL".
Thank you so much for your help.
Sincerely,
--
Cong Nguyen

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 373
Default Expanding sequence of data

Cong, assuming they're all integers with no spaces, this should work. Copy
this code and paste into a standard module. Select as many cells as needed
(selection must be continuous and should all be in the same column). Hope
this helps! James

Sub Expand()
Dim L As String, R As String, P As Integer
Dim cell As Range, k As Integer
For Each cell In Selection
P = InStr(cell, "-")
If P 1 Then
L = Left(cell, P - 1)
R = Right(cell, Len(cell) - P)
For k = 0 To CInt(R) - CInt(L)
cell.Offset(0, k + 1) = L + k
Next k
End If
Next cell
End Sub

"Cong Nguyen" wrote in message
...
Please show me how to go from:
234-238 (in one cell) to: 234 235 236 237 238 (each in individual
cell).
My worksheet has so many of these numbers and can't use "FILL".
Thank you so much for your help.
Sincerely,
--
Cong Nguyen



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 611
Default Expanding sequence of data

Multiposted.

--
Earl Kiosterud
www.smokeylake.com

Note: Top-posting has been the norm here.
Some folks prefer bottom-posting.
But if you bottom-post to a reply that's
already top-posted, the thread gets messy.
When in Rome...
-----------------------------------------------------------------------
"Cong Nguyen" wrote in message
...
Please show me how to go from:
234-238 (in one cell) to: 234 235 236 237 238 (each in individual
cell).
My worksheet has so many of these numbers and can't use "FILL".
Thank you so much for your help.
Sincerely,
--
Cong Nguyen



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
Expanding amount of data in a formula John Excel Discussion (Misc queries) 3 October 27th 06 11:43 PM
sorting data and expanding the selection Barnet1 Excel Discussion (Misc queries) 2 January 23rd 06 01:50 PM
Expanding data Excels Cracking me up! Excel Worksheet Functions 2 November 9th 05 02:07 PM
Expanding Data validation from List mark hansen Excel Discussion (Misc queries) 2 September 4th 05 01:39 AM
Linked query not expanding with new data Deb Excel Worksheet Functions 0 February 16th 05 07:09 PM


All times are GMT +1. The time now is 08:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"