ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Why is delimit failing me _now_??? (https://www.excelbanter.com/excel-programming/294059-why-delimit-failing-me-_now_.html)

Patti[_3_]

Why is delimit failing me _now_???
 
I got the following directly from the macro recorder, and it has worked
without fail for days. Suddenly, I am getting the error message "Compile
Error: Wrong number of arguments or invalid property assignment" and it is
highlighting the word "Range" between "Selection.TextToColumns Destination:=
"and "("A1)."

I am using the exact same information when running the procedure, and I can
still run it in my back-up sheet. The only thing that has changed since
last night is that I added a procedure that merged some cells at the end of
my routine (well after Sub Delimit has run).

I have deleted all merged cells from the sheet before running Sub Delimit
again (by going to Special Cells Last Cell, selecting/deleting) so I don't
think that's it. A1 is currently the last cell. I also commented out the
procedure that merges the cells.

If anyone can give me any ideas on where I went wrong and how to fix it, I
would be _most_ appreciative. If the files won't delimit properly, my whole
routine is toast.

Thanks in advance,

Patti


Sub DelimitFile()
' delimit report
On Error Resume Next
Selection.TextToColumns Destination:=Range("A1"),
DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(16, 1), Array(30, 1), Array(54,
1), Array(57, 1), _
Array(71, 1), Array(83, 1), Array(94, 1), Array(100, 1), Array(106,
1), Array(112, 1), _
Array(118, 1), Array(124, 1), Array(130, 1), Array(136, 1),
Array(142, 1), Array(148, 1))
On Error GoTo 0
End Sub



Tom Ogilvy

Why is delimit failing me _now_???
 
You have defined a variable as Range (probably a typo).

Try putting

Option Explicit
at the very top of the module, then do
Debug = compile vbaProject

It should highlight where it sees range as a variable (probably in your
added code)

Anyway, you need to remove this usage of range as a variable. Use some
other variable name.

--
Regards,
Tom Ogilvy

"Patti" wrote in message
...
I got the following directly from the macro recorder, and it has worked
without fail for days. Suddenly, I am getting the error message "Compile
Error: Wrong number of arguments or invalid property assignment" and it

is
highlighting the word "Range" between "Selection.TextToColumns

Destination:=
"and "("A1)."

I am using the exact same information when running the procedure, and I

can
still run it in my back-up sheet. The only thing that has changed since
last night is that I added a procedure that merged some cells at the end

of
my routine (well after Sub Delimit has run).

I have deleted all merged cells from the sheet before running Sub Delimit
again (by going to Special Cells Last Cell, selecting/deleting) so I

don't
think that's it. A1 is currently the last cell. I also commented out the
procedure that merges the cells.

If anyone can give me any ideas on where I went wrong and how to fix it, I
would be _most_ appreciative. If the files won't delimit properly, my

whole
routine is toast.

Thanks in advance,

Patti


Sub DelimitFile()
' delimit report
On Error Resume Next
Selection.TextToColumns Destination:=Range("A1"),
DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(16, 1), Array(30, 1),

Array(54,
1), Array(57, 1), _
Array(71, 1), Array(83, 1), Array(94, 1), Array(100, 1),

Array(106,
1), Array(112, 1), _
Array(118, 1), Array(124, 1), Array(130, 1), Array(136, 1),
Array(142, 1), Array(148, 1))
On Error GoTo 0
End Sub





Patti[_3_]

Why is delimit failing me _now_???
 
Excellent Tom. Thank you!


"Tom Ogilvy" wrote in message
...
You have defined a variable as Range (probably a typo).

Try putting

Option Explicit
at the very top of the module, then do
Debug = compile vbaProject

It should highlight where it sees range as a variable (probably in your
added code)

Anyway, you need to remove this usage of range as a variable. Use some
other variable name.

--
Regards,
Tom Ogilvy

"Patti" wrote in message
...
I got the following directly from the macro recorder, and it has worked
without fail for days. Suddenly, I am getting the error message

"Compile
Error: Wrong number of arguments or invalid property assignment" and it

is
highlighting the word "Range" between "Selection.TextToColumns

Destination:=
"and "("A1)."

I am using the exact same information when running the procedure, and I

can
still run it in my back-up sheet. The only thing that has changed

since
last night is that I added a procedure that merged some cells at the end

of
my routine (well after Sub Delimit has run).

I have deleted all merged cells from the sheet before running Sub

Delimit
again (by going to Special Cells Last Cell, selecting/deleting) so I

don't
think that's it. A1 is currently the last cell. I also commented out

the
procedure that merges the cells.

If anyone can give me any ideas on where I went wrong and how to fix it,

I
would be _most_ appreciative. If the files won't delimit properly, my

whole
routine is toast.

Thanks in advance,

Patti


Sub DelimitFile()
' delimit report
On Error Resume Next
Selection.TextToColumns Destination:=Range("A1"),
DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(16, 1), Array(30, 1),

Array(54,
1), Array(57, 1), _
Array(71, 1), Array(83, 1), Array(94, 1), Array(100, 1),

Array(106,
1), Array(112, 1), _
Array(118, 1), Array(124, 1), Array(130, 1), Array(136, 1),
Array(142, 1), Array(148, 1))
On Error GoTo 0
End Sub








All times are GMT +1. The time now is 03:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com