View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
FSt1 FSt1 is offline
external usenet poster
 
Posts: 3,942
Default Macro for text to column

hi
this is what is restricting it to D.
Destination:=Range("D1")
change to...
Destination:=selection.offset(0,1)

note: make sure that your column next to your target column is blank for
text to columns will overwrite data.

Regards
FSt1

"Garrystone" wrote:


Hi Everyone,
I have the macro below that splits the cell content of column D.
However, this only works for those values in column D
(Destination:=Range("D1")). I have tried a few things but can't get it
right, I want the macro to run on any column I choose and not just
Column D. Can anybody help?

Sub Split_Cells()

ActiveCell.EntireColumn.Select
Selection.TextToColumns Destination:=Range("D1"),
DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(1, 1)),
TrailingMinusNumbers:=True
End Sub

Thank you

Garry




--
Garrystone