Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default replace dash in a number sequence

I've got a cell that represents a sequence of numbers like p129-132 and would
like to list each number seperately: p129,p130,p131,p132.

TIA


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default replace dash in a number sequence

Select the cells containing the data and run:

Sub ListMaker()
Dim n1 As Integer, n2 As Integer
Dim v As String
For Each r In Selection
s = Split(r.Value, "-")
n2 = s(1)
n1 = Right(s(0), Len(s(0)) - 1) + 1
v = s(0)
For i = n1 To n2
v = v & "," & i
Next
r.Value = v
Next
End Sub
--
Gary''s Student - gsnu200769


"Willy Wonka" wrote:

I've got a cell that represents a sequence of numbers like p129-132 and would
like to list each number seperately: p129,p130,p131,p132.

TIA


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
Extract number between a dash Eric Excel Discussion (Misc queries) 3 January 24th 08 12:37 AM
How to find & replace a formula sequence with * in it? creativeops Excel Discussion (Misc queries) 2 September 8th 06 05:17 PM
Replacing dash in item number tmcleod Excel Discussion (Misc queries) 3 March 29th 06 12:14 AM
Replace Error with a Dash Karen Excel Worksheet Functions 3 March 14th 06 05:33 PM
understanding dash dash in a excel formula ldebner Excel Worksheet Functions 2 October 31st 05 01:47 PM


All times are GMT +1. The time now is 12:46 PM.

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"