Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to write a short macro for excel that will take the content
of a cell and then break each character up into a different cell. For example, in cell 1-A is "U1234A" I need my macro to break that into: 2-A = "U" , 2-B = "1" , 2-C = "2" , 2-D = "3" ...... etc. Can anyone give me a quick example code? My main problem is I don know how to program the macro to pull each character out of a selecte cell and break it up. I was thinking maybe put it into an array -- Message posted from http://www.ExcelForum.com |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub BreakItUp()
Set rngSource = Range("a1") For z = 1 To Len(rngSource) rngSource.Offset(0, z) = Mid(rngSource, z, 1) Next z End Sub regards "anthrobro " wrote in message ... I am trying to write a short macro for excel that will take the contents of a cell and then break each character up into a different cell. For example, in cell 1-A is "U1234A" I need my macro to break that into: 2-A = "U" , 2-B = "1" , 2-C = "2" , 2-D = "3" ...... etc. Can anyone give me a quick example code? My main problem is I dont know how to program the macro to pull each character out of a selected cell and break it up. I was thinking maybe put it into an array? --- Message posted from http://www.ExcelForum.com/ |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can do it with worksheet functions
2A: =IF(LEN($A$1)=COLUMN(A2),MID($A$1,COLUMN(A2),1)," ") copy across -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "anthrobro " wrote in message ... I am trying to write a short macro for excel that will take the contents of a cell and then break each character up into a different cell. For example, in cell 1-A is "U1234A" I need my macro to break that into: 2-A = "U" , 2-B = "1" , 2-C = "2" , 2-D = "3" ...... etc. Can anyone give me a quick example code? My main problem is I dont know how to program the macro to pull each character out of a selected cell and break it up. I was thinking maybe put it into an array? --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
divide | Excel Discussion (Misc queries) | |||
Divide by 3 | Excel Discussion (Misc queries) | |||
divide by 0 | Excel Worksheet Functions | |||
Divide by Zero | Excel Worksheet Functions | |||
Divide one row over other row I dont wont to divide one number | Excel Discussion (Misc queries) |