ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Convert Data Range in to individual values (https://www.excelbanter.com/excel-discussion-misc-queries/92564-convert-data-range-individual-values.html)

mistryrg

Convert Data Range in to individual values
 
Hi,

Need some help!

I am trying to convert a spreadsheet of data which has individual cells and data-range cells and convert them into indvidual values.

e.g.

50010
50013
50020-50033
50050

The individual cells are fine, but the 50020-50033 for example I want to be able to convert/export as individual cells, i.e. 50020, 50021, 50022,...50031,50033.

Can anyone please help me with this.

All help is very much appreciated

Thanks
Raj Mistry

robert111

Convert Data Range in to individual values
 

select all, format cells alignment, uncheck merged cells


--
robert111
------------------------------------------------------------------------
robert111's Profile: http://www.excelforum.com/member.php...o&userid=31996
View this thread: http://www.excelforum.com/showthread...hreadid=549434


Don Guillett

Convert Data Range in to individual values
 
If you meant
50020
50021
50022
50023
50024
50025

then try

Sub fixdata()
For i = Cells(Rows.Count, "d").End(xlUp).Row To 2 Step -1
Set mc = Cells(i, 4)
inst = InStr(mc, "-")
If inst 0 Then
n1 = Left(mc, inst - 1)
n2 = Right(mc, Len(mc) - inst)
Count = n2 - n1
mc.Value = n1
Cells(mc.Row + 1, 4).Resize(Count, 1).EntireRow.Insert
mc.AutoFill Destination:=mc.Resize(Count + 1)
End If
Next i
End Sub

--
Don Guillett
SalesAid Software

"mistryrg" wrote in message
...

Hi,

Need some help!

I am trying to convert a spreadsheet of data which has individual cells
and data-range cells and convert them into indvidual values.

e.g.

50010
50013
50020-50033
50050

The individual cells are fine, but the 50020-50033 for example I want
to be able to convert/export as individual cells, i.e. 50020, 50021,
50022,...50031,50033.

Can anyone please help me with this.

All help is very much appreciated

Thanks
Raj Mistry


--
mistryrg





All times are GMT +1. The time now is 02:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com