Hi
I have large text files to convert and I would like to get all the codes combined into one, if thats possible.
The text i want to parse has various quantity of 7 character partnumbers at the end. one piece of code splits the string out and the following formula can remove all the pieces split out from the original string so basically i have the fully original string and then the string split out into the individual parts.
I cant find the vba for this formula but i have placed it below where it should run
=LEFT(A1,SEARCH(B1,A1)-1)
Can somebody take a look at that and maybe combine the formula and the following code into one piece?
The code is in the order I'd like it performed - with the formula inserted where it should be.
The one issue i found while testing the individual pieces is that most of them require the columns to be manually selected which i would prefer to happen automatically
(I've found all this vba on the net)
Thanks
John
Sub trimAnd Clean()
Dim x As Long
x = Range("B63556").End(xlUp).Row
For i = 1 To x
Cells(i, 2) = Application.Clean(Application.Trim(Cells(i, 2)))
Next
On Error Resume Next
Columns(2).Replace What:=Chr(160), Replacement:="", LookAt:=xlPart
End Sub
Sub ParseFromRight()
Dim LR As Long, i As Long, x As Long, Counter As Long, ValArray As Variant
LR = Cells(Rows.Count, "A").End(xlUp).Row
For i = 2 To LR
Counter = 0
With Cells(i, "A")
ValArray = Split(.Value, " ")
For x = UBound(ValArray) To LBound(ValArray) Step -1
If Len(ValArray(x)) <> 7 Then Exit For
Counter = Counter + 1
.Offset(0, Counter).Value = ValArray(x)
Next x
End With
Next i
End Sub
=LEFT(A1,SEARCH(B1,A1)-1)
Sub FlipColumns()
Dim vTop As Variant
Dim vEnd As Variant
Dim iStart As Integer
Dim iEnd As Integer
Application.ScreenUpdating = False
iStart = 1
iEnd = Selection.Columns.Count
Do While iStart < iEnd
vTop = Selection.Columns(iStart)
vEnd = Selection.Columns(iEnd)
Selection.Columns(iEnd) = vTop
Selection.Columns(iStart) = vEnd
iStart = iStart + 1
iEnd = iEnd - 1
Loop
Application.ScreenUpdating = True
End Sub
Sub DelEmptyMoveLeft()
Cells.Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.Delete Shift:=xlToLeft
End Sub
Bookmarks