ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Moving cell data left (https://www.excelbanter.com/excel-programming/448100-moving-cell-data-left.html)

themiz

Moving cell data left
 
1 Attachment(s)
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!

Auric__

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.


All times are GMT +1. The time now is 01:34 PM.

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