Thread
:
macro "text to column" for excel
View Single Post
#
11
Posted to microsoft.public.excel.programming
[email protected]
external usenet poster
Posts: 7
macro "text to column" for excel
How do I select a range, when I am trying to use the cell I am in?
"Dave Peterson" wrote:
Tom's code still worked ok for me:
Option Explicit
Sub testme()
With Selection
.TextToColumns _
Destination:=.Cells(1), _
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, _
Tab:=False, _
Semicolon:=False, _
Comma:=True, _
Space:=False, _
Other:=False, _
FieldInfo:=Array(1, 1)
End With
End Sub
Make sure you select your range first.
wrote:
Tom, Dave
I am batting zero..
Task:
81 GREEN HILL ROAD, CHESTER, NJ, 07930
I am trying to run a macro for the above example, for a result that using
"text to column" puts the adress, city state and zip in separate columns.
Also, my 1st cell is the cell with all the information before I run the
macro. Text to column works a cell at a time, I can't get a macro to automate
the task and I have nearly 4000 lines.
Looking for assistance.
my current macro reads as follows:
Sub T()
'
' T Macro
' Macro recorded 9/22/2006 by George Crain
'
' Keyboard Shortcut: Ctrl+a
'
Selection.TextToColumns Destination:=.cells(1), DataType:=xlDelimited,
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False,
Tab:=False, _
Semicolon:=False, Comma:=True, Space:=False, Other:=False, FieldInfo _
:=Array(1, 1)
End Sub
"Tom Ogilvy" wrote:
see correction posted in your thread.
--
Regards,
Tom Ogilvy
" wrote:
Sub T()
'
' T Macro
' Macro recorded 9/22/2006 by George Crain
'
' Keyboard Shortcut: Ctrl+a
'
Selection.TextToColumns Destination:=cells(1), DataType:=xlDelimited,
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False,
Tab:=False, _
Semicolon:=False, Comma:=True, Space:=False, Other:=False, FieldInfo _
:=Array(1, 1)
End Sub
The above MACRO does not execute. I am trying take 1 cell of text data, and
spread it (comma delimited) across 4 cells using the original cell I am in.
Thanks in advance for your help.
G. Crain
" wrote:
I want to automate the "text to column" function. I can created the macro;
however, when I rerun the macro on a new row/cell, it writes back to the
previous row/cell and overwrites what is there.
I need the macro to run in the new row/cell where my cursor is, and then not
rewrite back to any previous work.
Thanks
George Crain
--
Dave Peterson
Reply With Quote
[email protected]
View Public Profile
Find all posts by
[email protected]