Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Moving cell data left
Hi there, thank you in advance for any and all help.
In the attached wrkbook, you'll see columns with "##### - Name". I want to separate the two values (the numbers and the description) and move the numbers to column A. I have been using a macro to separate the cell data and was wondering if someone could help me insert a line for moving the (new separated) "#####" data to column A. Thanks again! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Moving cell data left
themiz wrote:
Hi there, thank you in advance for any and all help. In the attached wrkbook, you'll see columns with "##### - Name". I want to separate the two values (the numbers and the description) and move the numbers to column A. I have been using a macro to separate the cell data and was wondering if someone could help me insert a line for moving the (new separated) "#####" data to column A. Your file doesn't have anything in that format. If the info is *always* in that format, rather than using Like, Split, etc., as in the code attached to that file (and also avoiding the need for 3 separate subs) I'd just do something like this: Sub colNew() Dim r As Range For Each r In Range("D1:F" & _ Cells.SpecialCells(xlCellTypeLastCell).Row) tmp$ = r.Value where = InStr(tmp$, " - ") If where Then numpart = Left$(tmp$, where - 1) namepart = Mid$(tmp$, where + 3) Cells(r.Row, 1).Value = numpart Cells(r.Row, 2).Value = namepart End If Next End Sub The targets for numpart and namepart will need to be verified by you. -- If it requires a "C:" drive and it's not called "DOS", then I don't need it. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Moving data left | Excel Discussion (Misc queries) | |||
Moving left of a cell reference | Excel Worksheet Functions | |||
Moving left of a cell reference | Excel Worksheet Functions | |||
Moving left/right from active cell | Excel Programming | |||
Moving Cell up, down, left or right thru Macros | Excel Programming |