View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Per Jessen[_2_] Per Jessen[_2_] is offline
external usenet poster
 
Posts: 703
Default Moving extra characters to a new column

Try this:

Sub SplitData()
Dim cell As Range

For Each cell In Columns(1).Cells
If Len(cell.Value) 255 Then
cell.Offset(0, 1) = Mid(cell.Value, 256)
cell = Left(cell.Value, 255)
End If
Next
End Sub

Regards,
Per

On 30 Dec., 20:53, Tom wrote:
I am reformatting spreadsheets so they can be uploaded into a
database, and need to make sure that there are no more than 255
characters in each cell. *I don't want to lose the information though,
so is there VBA code I could use that would take any text over the 255
limit and move it into the cell immediatly to the the right?

Thanks