View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
[email protected] johan.georget@gmail.com is offline
external usenet poster
 
Posts: 3
Default Creation of a table of n values

Rick, I have only one column to create.
Nigel, I am actually using excel 2003. It is indeed possible to run
out of rows with the kind of result I expect, although in my case the
final table is around 30,000 rows.

Gary, thx for your help. I finally succeeded to get what I was looking
for.

On Jul 11, 3:00*pm, "Gary Keramidas" <GKeramidasATmsn.com wrote:
you can change the column letter to what you want

Sub test()
* * * Dim i As Long
* * * Dim j As Long
* * * Dim lastrow As Long
* * * Dim cell As Range
* * * Dim numval As Long
* * * Dim z As Long
* * * Dim ws As Worksheet
* * * z = 1

* * * Set ws = Worksheets("Sheet1")
* * * lastrow = ws.Cells(Rows.Count, "A").End(xlUp).Row
* * * For Each cell In ws.Range("A1:A" & lastrow)
* * * * * * For i = 1 To Len(cell.Value)
* * * * * * * * * numval = Mid(cell.Value, i, 1)
* * * * * * * * * For j = 1 To numval
* * * * * * * * * * * * ws.Cells(z, "B").Value = numval
* * * * * * * * * * * * z = z + 1
* * * * * * * * * Next
* * * * * * Next
* * * Next
End Sub

--

Gary

wrote in message

...

Thx. It is not exactly what I am looking for but I can use it as a
good basis. (I actually don't need to create new columns for each
value, everything should be listed in one column)


On 11 juil, 13:48, "Gary Keramidas" <GKeramidasATmsn.com wrote:
i forgot to ask what you wanted to do if a number had a zero in it.


--


Gary


wrote in message


...


Hi all,


I have a small but anyway very interesting problem with Excel.
I am actually starting from a table with some values inside. For
example:
4
2
5


I am looking for a formula which would give me a new table like this:
4
4
4
4
2
2
5
5
5
5
5


I tried quite a few things, especially with the offset function, but
couldn't set it. Your help would be greatly appreciated!
Of course, I can't do it manually as my numbers look like 127,221 and
not 4 or 5.


Thank you,
Johan