View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
goconnor goconnor is offline
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