VBA or Code For split the data

Vishaal

Active Member
Hi All,

Thanks in advance,

i have a data

Coloumn 1 Coloumn 2
2305
2054
0654

<tbody>
</tbody>

now i want to split, but when we split the data, "0" is not coming

Col 1Col 2Col 3Col 4Col 5
2305235
2054254
0654654

<tbody>
</tbody>

pls provide the VBA code/ formula
 

tyija1995

Well-known Member
Given first cell (2305) is in A2 try this in B2 and copy across:

IF(VALUE(MID($A2,COLUMNS($B$1:B1),1))=0,"",MID($A2,COLUMNS($B$1:B1),1))
 

Fluff

MrExcel MVP, Moderator
How about
<b></b><table cellpadding="2.5px" rules="all" style=";background-color: rgb(255,255,255);border: 1px solid;border-collapse: collapse; border-color: rgb(187,187,187)"><colgroup><col width="25px" style="background-color: rgb(218,231,245)" /><col /><col /><col /><col /><col /><col /></colgroup><thead><tr style=" background-color: rgb(218,231,245);text-align: center;color: rgb(22,17,32)"><th></th><th>A</th><th>B</th><th>C</th><th>D</th><th>E</th><th>F</th></tr></thead><tbody><tr ><td style="color: rgb(22,17,32);text-align: center;">1</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">2</td><td style="text-align: right;;">12305</td><td style="text-align: right;;">1</td><td style="text-align: right;;">2</td><td style="text-align: right;;">3</td><td style="text-align: right;;">0</td><td style="text-align: right;;">5</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">3</td><td style="text-align: right;;">2054</td><td style="text-align: right;;">2</td><td style="text-align: right;;">0</td><td style="text-align: right;;">5</td><td style="text-align: right;;">4</td><td style=";"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">4</td><td style="text-align: right;;">0654</td><td style="text-align: right;;">0</td><td style="text-align: right;;">6</td><td style="text-align: right;;">5</td><td style="text-align: right;;">4</td><td style=";"></td></tr></tbody></table><p style="width:3.2em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid rgb(187,187,187);border-top:none;text-align: center;background-color: rgb(218,231,245);color: rgb(22,17,32)">Data</p><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: rgb(255,255,255)" ><tr><td style="padding:6px" ><b>Worksheet Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: rgb(255,255,255);border-collapse: collapse; border-color: rgb(187,187,187)"><thead><tr style=" background-color: rgb(218,231,245);color: rgb(22,17,32)"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: rgb(218,231,245);color: rgb(22,17,32)">B2</th><td style="text-align:left">=MID(<font color="Blue">$A2,COLUMNS(<font color="Red">$B$1:B1</font>),1</font>)</td></tr></tbody></table></td></tr></table><br />
 

mohadin

Active Member
And what about
Code:
Sub test()
    lr = Cells(Rows.Count, 1).End(xlUp).Row
    For i = 1 To lr
        For j = 1 To Len(Cells(i, 1))
             Cells(i, j).Offset(0, 1) = Mid(Cells(i, 1), j, 1)
        Next
    Next
End Sub
 

SpillerBD

Well-known Member
given first cell (2305) is in a2 try this in b2 and copy across:

If(value(mid($a2,columns($b$1:b1),1))=0,"",mid($a2,columns($b$1:b1),1))
Rich (BB code):
if(value(mid($a2,columns($b$1:b1),1))=0,"0",text(mid($a2,columns($b$1:b1),1)))
 

Some videos you may like

This Week's Hot Topics

Top