T
Tom Walat
Having a little difficulty here. Using Excel 2000/WinNT4.
The macro below looks for a particular phrase on a worksheet,
when it finds it the second time, it selects that cell and the cell
below it.
I then want to run a TextToColumns on that selection.
Instead I get:
Run-time error '1004'
Method 'Range' of object '_Global' failed
Thanks for any help.
- Tom
*******************************************
Sub aaaaFormatTotalsLine()
Range("A1").Select
Cells.Find(What:="TOWN", After:=ActiveCell, LookIn:=xlValues,
LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False).Activate
Cells.Find(What:="TOWN", After:=ActiveCell, LookIn:=xlValues,
LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False).Activate
' SELECT CONSECUTIVE CELLS
Range(ActiveCell, ActiveCell.Offset(1, 0)).Select
' CONVERT TEXT TO COLUMNS
Selection.TextToColumns Destination:=Range(Selection),
DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(21, 1), Array(27, 1),
Array(35, 1), Array(43, 1))
End Sub
The macro below looks for a particular phrase on a worksheet,
when it finds it the second time, it selects that cell and the cell
below it.
I then want to run a TextToColumns on that selection.
Instead I get:
Run-time error '1004'
Method 'Range' of object '_Global' failed
Thanks for any help.
- Tom
*******************************************
Sub aaaaFormatTotalsLine()
Range("A1").Select
Cells.Find(What:="TOWN", After:=ActiveCell, LookIn:=xlValues,
LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False).Activate
Cells.Find(What:="TOWN", After:=ActiveCell, LookIn:=xlValues,
LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False).Activate
' SELECT CONSECUTIVE CELLS
Range(ActiveCell, ActiveCell.Offset(1, 0)).Select
' CONVERT TEXT TO COLUMNS
Selection.TextToColumns Destination:=Range(Selection),
DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(21, 1), Array(27, 1),
Array(35, 1), Array(43, 1))
End Sub