![]() |
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 |
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 |
All times are GMT +1. The time now is 01:47 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com