Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default Run-time error '1004'

I have a macro (Excel 2003) which goes to a range (Range 1) of four columns
and 100 rows to copy to another range (Range 2). The first column of Range 1
contains bandomly-generated numbers (=RAND()). I have been using this file
for quite some time without any problem, as have a number of other people.
One user has reported that he is receiving a Run-time error '1004' each time
he tries to execute the macro. I have read the MS info re this error which
says:

"This issue may occur if one or more of the cells in an array (range of
cells) contain a character string that is set to contain more than 911
characters."

I have had trouble following the MS workaround which seems incredibly
complex. I have formated the random number column to ensure no more than 10
digits after the decimal point.

Can anyone offer any practical solutions to this issue?

--
Regards

goconnor
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default Run-time error '1004'

I should have specified the type of run-time error. In full:

Run-time error '1004'
Application-defined or object-defined error

--
Regards

goconnor


"goconnor" wrote:

I have a macro (Excel 2003) which goes to a range (Range 1) of four columns
and 100 rows to copy to another range (Range 2). The first column of Range 1
contains bandomly-generated numbers (=RAND()). I have been using this file
for quite some time without any problem, as have a number of other people.
One user has reported that he is receiving a Run-time error '1004' each time
he tries to execute the macro. I have read the MS info re this error which
says:

"This issue may occur if one or more of the cells in an array (range of
cells) contain a character string that is set to contain more than 911
characters."

I have had trouble following the MS workaround which seems incredibly
complex. I have formated the random number column to ensure no more than 10
digits after the decimal point.

Can anyone offer any practical solutions to this issue?

--
Regards

goconnor

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Run-time error '1004'

That 1004 error shows up in lots and lots of situations.

Can you post the relevant code and indicate the line that causes the error?

goconnor wrote:

I have a macro (Excel 2003) which goes to a range (Range 1) of four columns
and 100 rows to copy to another range (Range 2). The first column of Range 1
contains bandomly-generated numbers (=RAND()). I have been using this file
for quite some time without any problem, as have a number of other people.
One user has reported that he is receiving a Run-time error '1004' each time
he tries to execute the macro. I have read the MS info re this error which
says:

"This issue may occur if one or more of the cells in an array (range of
cells) contain a character string that is set to contain more than 911
characters."

I have had trouble following the MS workaround which seems incredibly
complex. I have formated the random number column to ensure no more than 10
digits after the decimal point.

Can anyone offer any practical solutions to this issue?

--
Regards

goconnor


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default Run-time error '1004'

Many thanks, Dave. Since I didn't have the problem myself, I can only go by
the screenshot of the error box which my correspondent sent to me. Based on
that shot, it looks like the problem occurred when the macro was executing a
sort by the random number column (AC). Here is that part of the code covering
that operation. ((I'm no coder, but I suspect much of the ActiveWindow ...
code is redundant?)

Application.Goto Reference:="Times_tables"
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 8
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 10
ActiveWindow.SmallScroll Down:=18
ActiveWindow.ScrollColumn = 11
ActiveWindow.ScrollColumn = 12
Range("AC62001:AF62144").Select
Application.CutCopyMode = False
Selection.Sort Key1:=Range("AC62001"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal


--
Regards

goconnor


"Dave Peterson" wrote:

That 1004 error shows up in lots and lots of situations.

Can you post the relevant code and indicate the line that causes the error?

goconnor wrote:

I have a macro (Excel 2003) which goes to a range (Range 1) of four columns
and 100 rows to copy to another range (Range 2). The first column of Range 1
contains bandomly-generated numbers (=RAND()). I have been using this file
for quite some time without any problem, as have a number of other people.
One user has reported that he is receiving a Run-time error '1004' each time
he tries to execute the macro. I have read the MS info re this error which
says:

"This issue may occur if one or more of the cells in an array (range of
cells) contain a character string that is set to contain more than 911
characters."

I have had trouble following the MS workaround which seems incredibly
complex. I have formated the random number column to ensure no more than 10
digits after the decimal point.

Can anyone offer any practical solutions to this issue?

--
Regards

goconnor


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Run-time error '1004'

The activewindow stuff won't hurt (or help) your code.

Application.Goto Reference:="Times_tables"
Range("AC62001:AF62144").Select
Selection.Sort Key1:=Range("AC62001"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

Are you both using the same version of excel?

DataOption# was added in xl2002 and will cause an error in earlier versions. I
don't recall if it's a 1004 error, though.

Try deleting that portion (and the previous comma and underscore, too).

======
My second guess would depend on where this code is located. Is it in a General
module or under a worksheet?



goconnor wrote:

Many thanks, Dave. Since I didn't have the problem myself, I can only go by
the screenshot of the error box which my correspondent sent to me. Based on
that shot, it looks like the problem occurred when the macro was executing a
sort by the random number column (AC). Here is that part of the code covering
that operation. ((I'm no coder, but I suspect much of the ActiveWindow ...
code is redundant?)

Application.Goto Reference:="Times_tables"
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 8
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 10
ActiveWindow.SmallScroll Down:=18
ActiveWindow.ScrollColumn = 11
ActiveWindow.ScrollColumn = 12
Range("AC62001:AF62144").Select
Application.CutCopyMode = False
Selection.Sort Key1:=Range("AC62001"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

--
Regards

goconnor

"Dave Peterson" wrote:

That 1004 error shows up in lots and lots of situations.

Can you post the relevant code and indicate the line that causes the error?

goconnor wrote:

I have a macro (Excel 2003) which goes to a range (Range 1) of four columns
and 100 rows to copy to another range (Range 2). The first column of Range 1
contains bandomly-generated numbers (=RAND()). I have been using this file
for quite some time without any problem, as have a number of other people.
One user has reported that he is receiving a Run-time error '1004' each time
he tries to execute the macro. I have read the MS info re this error which
says:

"This issue may occur if one or more of the cells in an array (range of
cells) contain a character string that is set to contain more than 911
characters."

I have had trouble following the MS workaround which seems incredibly
complex. I have formated the random number column to ensure no more than 10
digits after the decimal point.

Can anyone offer any practical solutions to this issue?

--
Regards

goconnor


--

Dave Peterson


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default Run-time error '1004'

Thanks again, Dave. Apologies for any delay - I'm based in Australia. I'm not
sure what version was being used by the person who had the problem - I'll
check that today. The code is included under general modules - i.e. it's
under the Modules directory rather than the Microsoft Excel Objects directory
in VBAProject.

I have removed the DataOption code as you suggested and don't seem to have
lost any functionality in 2003. Is there any reason this should cause a
problem in 2003 or 2007?

Thanks again for your help.

--
Regards

goconnor


"Dave Peterson" wrote:

The activewindow stuff won't hurt (or help) your code.

Application.Goto Reference:="Times_tables"
Range("AC62001:AF62144").Select
Selection.Sort Key1:=Range("AC62001"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

Are you both using the same version of excel?

DataOption# was added in xl2002 and will cause an error in earlier versions. I
don't recall if it's a 1004 error, though.

Try deleting that portion (and the previous comma and underscore, too).

======
My second guess would depend on where this code is located. Is it in a General
module or under a worksheet?



goconnor wrote:

Many thanks, Dave. Since I didn't have the problem myself, I can only go by
the screenshot of the error box which my correspondent sent to me. Based on
that shot, it looks like the problem occurred when the macro was executing a
sort by the random number column (AC). Here is that part of the code covering
that operation. ((I'm no coder, but I suspect much of the ActiveWindow ...
code is redundant?)

Application.Goto Reference:="Times_tables"
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 8
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 10
ActiveWindow.SmallScroll Down:=18
ActiveWindow.ScrollColumn = 11
ActiveWindow.ScrollColumn = 12
Range("AC62001:AF62144").Select
Application.CutCopyMode = False
Selection.Sort Key1:=Range("AC62001"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

--
Regards

goconnor

"Dave Peterson" wrote:

That 1004 error shows up in lots and lots of situations.

Can you post the relevant code and indicate the line that causes the error?

goconnor wrote:

I have a macro (Excel 2003) which goes to a range (Range 1) of four columns
and 100 rows to copy to another range (Range 2). The first column of Range 1
contains bandomly-generated numbers (=RAND()). I have been using this file
for quite some time without any problem, as have a number of other people.
One user has reported that he is receiving a Run-time error '1004' each time
he tries to execute the macro. I have read the MS info re this error which
says:

"This issue may occur if one or more of the cells in an array (range of
cells) contain a character string that is set to contain more than 911
characters."

I have had trouble following the MS workaround which seems incredibly
complex. I have formated the random number column to ensure no more than 10
digits after the decimal point.

Can anyone offer any practical solutions to this issue?

--
Regards

goconnor

--

Dave Peterson


--

Dave Peterson

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Run-time error '1004'

Since you have xl2003, you can read what that parm does in VBA's help.

Everything I've ever done (as far as I can recall) has used the default. On the
other hand, your requirements may differ. (I bet not!)

goconnor wrote:

Thanks again, Dave. Apologies for any delay - I'm based in Australia. I'm not
sure what version was being used by the person who had the problem - I'll
check that today. The code is included under general modules - i.e. it's
under the Modules directory rather than the Microsoft Excel Objects directory
in VBAProject.

I have removed the DataOption code as you suggested and don't seem to have
lost any functionality in 2003. Is there any reason this should cause a
problem in 2003 or 2007?

Thanks again for your help.

--
Regards

goconnor

"Dave Peterson" wrote:

The activewindow stuff won't hurt (or help) your code.

Application.Goto Reference:="Times_tables"
Range("AC62001:AF62144").Select
Selection.Sort Key1:=Range("AC62001"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

Are you both using the same version of excel?

DataOption# was added in xl2002 and will cause an error in earlier versions. I
don't recall if it's a 1004 error, though.

Try deleting that portion (and the previous comma and underscore, too).

======
My second guess would depend on where this code is located. Is it in a General
module or under a worksheet?



goconnor wrote:

Many thanks, Dave. Since I didn't have the problem myself, I can only go by
the screenshot of the error box which my correspondent sent to me. Based on
that shot, it looks like the problem occurred when the macro was executing a
sort by the random number column (AC). Here is that part of the code covering
that operation. ((I'm no coder, but I suspect much of the ActiveWindow ...
code is redundant?)

Application.Goto Reference:="Times_tables"
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 8
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 10
ActiveWindow.SmallScroll Down:=18
ActiveWindow.ScrollColumn = 11
ActiveWindow.ScrollColumn = 12
Range("AC62001:AF62144").Select
Application.CutCopyMode = False
Selection.Sort Key1:=Range("AC62001"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

--
Regards

goconnor

"Dave Peterson" wrote:

That 1004 error shows up in lots and lots of situations.

Can you post the relevant code and indicate the line that causes the error?

goconnor wrote:

I have a macro (Excel 2003) which goes to a range (Range 1) of four columns
and 100 rows to copy to another range (Range 2). The first column of Range 1
contains bandomly-generated numbers (=RAND()). I have been using this file
for quite some time without any problem, as have a number of other people.
One user has reported that he is receiving a Run-time error '1004' each time
he tries to execute the macro. I have read the MS info re this error which
says:

"This issue may occur if one or more of the cells in an array (range of
cells) contain a character string that is set to contain more than 911
characters."

I have had trouble following the MS workaround which seems incredibly
complex. I have formated the random number column to ensure no more than 10
digits after the decimal point.

Can anyone offer any practical solutions to this issue?

--
Regards

goconnor

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Run time error '1004' aeddave Excel Worksheet Functions 1 January 30th 08 08:26 PM
run time error 1004 brownti via OfficeKB.com Excel Discussion (Misc queries) 5 February 14th 07 04:50 PM
Run time error 1004 Potoroo Excel Discussion (Misc queries) 2 December 30th 05 02:42 AM
Run-time error '1004 shternm Excel Discussion (Misc queries) 7 October 3rd 05 07:38 PM
Run time error 1004, General ODBC error [email protected] New Users to Excel 0 September 19th 05 01:41 AM


All times are GMT +1. The time now is 04:25 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"