Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Autofill method of range class failed - sometimes


HI all,

I am using Excel 97 (it has to work under it)

Here is the code I have that breaks
....

Code
-------------------
prev_points = 4 'this changes in a different place I just put it here so you can see it's value

Range("Calculations!G" & CStr(prev_points + 1)).AutoFill Destination:=Range("Calculations!G" & CStr(prev_points + 1) & ":Calculations!G" & CStr(21 + 1)), Type:=xlFillDefault

' Cell G5 has a formula that needs to be copied down.
-------------------

...

Well sometimes it doesn't break. Any ideas why

--
Intellihom
-----------------------------------------------------------------------
Intellihome's Profile: http://www.msusenet.com/member.php?userid=147
View this thread: http://www.msusenet.com/t-187044591

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Autofill method of range class failed - sometimes

Intellihome,

I would start by using the standard range object usage:

With Worksheets("Calculations")
.Range("G" & CStr(prev_points + 1)).AutoFill _
Destination:=.Range("G" & CStr(prev_points + 1) & ":G" & _
CStr(21 + 1)), Type:=xlFillDefault
End With

HTH,
Bernie
MS Excel MVP


"Intellihome" wrote in message
...

HI all,

I am using Excel 97 (it has to work under it)

Here is the code I have that breaks
...

Code:
--------------------
prev_points = 4 'this changes in a different place I just put it here

so you can see it's value

Range("Calculations!G" & CStr(prev_points + 1)).AutoFill

Destination:=Range("Calculations!G" & CStr(prev_points + 1) &
":Calculations!G" & CStr(21 + 1)), Type:=xlFillDefault

' Cell G5 has a formula that needs to be copied down.
--------------------

..

Well sometimes it doesn't break. Any ideas why?


--
Intellihome
------------------------------------------------------------------------
Intellihome's Profile: http://www.msusenet.com/member.php?userid=1479
View this thread: http://www.msusenet.com/t-1870445918



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Autofill method of range class failed - sometimes

Does it ever break when you run this test (with prev_points = 4)?

What does break mean?

Some more questions...

Is the worksheet protected?

How does this macro get started? If it's started by a commandbutton from the
control toolbox toolbar (or a different control from that toolbar), try changing
the .takefocusonclick property to false (under the properties menu).

Or add:
activecell.activate
at the top of your code.

(This is a bug in xl97 that was fixed in xl2k.)





Intellihome wrote:

HI all,

I am using Excel 97 (it has to work under it)

Here is the code I have that breaks
...

Code:
--------------------
prev_points = 4 'this changes in a different place I just put it here so you can see it's value

Range("Calculations!G" & CStr(prev_points + 1)).AutoFill Destination:=Range("Calculations!G" & CStr(prev_points + 1) & ":Calculations!G" & CStr(21 + 1)), Type:=xlFillDefault

' Cell G5 has a formula that needs to be copied down.
--------------------

..

Well sometimes it doesn't break. Any ideas why?

--
Intellihome
------------------------------------------------------------------------
Intellihome's Profile: http://www.msusenet.com/member.php?userid=1479
View this thread: http://www.msusenet.com/t-1870445918


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Autofill method of range class failed - sometimes


Hello Dave,

Well I figure that within an hour, there is a bug , but I could no
access this forum to post my reply.

And problem is in the FOCUS. It wasn't getting focus properly.

What I do is at the beginning of the code I take off focus of all th
other objects on the sheet and make this an active sheet. Then it work
fine.

Other wise I get subj error message. Weird ha?

Another thing I have problem with is when I am using scroll bar t
scroll a chart and on change event trying to update worksheet -- i
seems like it is skipping some of the function calls to update a sheet

What I mean is that sometimes it works sometimes it does not. So thi
is how I fixed it.

Sub ScrollBar1_Change()

Application.Calculate '<< I put this same function twice, and it work
all the time
Application.Calculate '<< second call to this function updates whol
worksheet

End sub

This works fine unless I have around 3000 lines on a sheet, then
really get problems updating twice that kind a sheet takes a long time


May be there is a better way to fix it, I am new to Excel, just coupl
of weeks since I've started this project.

The other problem I get is when I have that many lines on my sheet an
I put functions beyond column GE, they would not work. They work when
do not have that many lines or they work if I put them before tha
column.

For example

I would need to sum all the elements in column lets say HH so I put
function SUM(HH:HH) and I get error. If I put SUM(HH1:HH3000) It works
and it works if I do the same for other column or if I have less lines
about 200. Bugs bugs bugs... everywhere :

--
Intellihom
-----------------------------------------------------------------------
Intellihome's Profile: http://www.msusenet.com/member.php?userid=147
View this thread: http://www.msusenet.com/t-187044591

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Autofill method of range class failed - sometimes


Hello Dave,

Well I figure that within an hour, there is a bug , but I could no
access this forum to post my reply.

And problem is in the FOCUS. It wasn't getting focus properly.

What I do is at the beginning of the code I take off focus of all th
other objects on the sheet and make this an active sheet. Then it work
fine.

Other wise I get subj error message. Weird ha?

Another thing I have problem with is when I am using scroll bar t
scroll a chart and on change event trying to update worksheet -- i
seems like it is skipping some of the function calls to update a sheet

What I mean is that sometimes it works sometimes it does not. So thi
is how I fixed it.

Sub ScrollBar1_Change()

Application.Calculate '<< I put this same function twice, and it work
all the time
Application.Calculate '<< second call to this function updates whol
worksheet

End sub

This works fine unless I have around 3000 lines on a sheet, then
really get problems updating twice that kind a sheet takes a long time


May be there is a better way to fix it, I am new to Excel, just coupl
of weeks since I've started this project.

The other problem I get is when I have that many lines on my sheet an
I put functions beyond column GE, they would not work. They work when
do not have that many lines or they work if I put them before tha
column.

For example

I would need to sum all the elements in column lets say HH so I put
function SUM(HH:HH) and I get error. If I put SUM(HH1:HH3000) It works
and it works if I do the same for other column or if I have less lines
about 200. Bugs bugs bugs... everywhere :

--
Intellihom
-----------------------------------------------------------------------
Intellihome's Profile: http://www.msusenet.com/member.php?userid=147
View this thread: http://www.msusenet.com/t-187044591



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Autofill method of range class failed - sometimes

If this =SUM(HH:HH) returns an error, then I'm betting that there is an error in
column HH (maybe on a hidden row or after row 3000).

If you show all the rows, then select column HH, you can:
edit|goto special
click Constants
uncheck Numbers, Text, Logicals (leave Errors checked).

Then check the same thing in formulas:
select column HH
edit|goto special
click Formulas
uncheck Numbers, Text, Logicals (leave Errors checked).

If you get any cells selected, then clean up those errors and you'll be fine.

Intellihome wrote:

Hello Dave,

Well I figure that within an hour, there is a bug , but I could not
access this forum to post my reply.

And problem is in the FOCUS. It wasn't getting focus properly.

What I do is at the beginning of the code I take off focus of all the
other objects on the sheet and make this an active sheet. Then it works
fine.

Other wise I get subj error message. Weird ha?

Another thing I have problem with is when I am using scroll bar to
scroll a chart and on change event trying to update worksheet -- it
seems like it is skipping some of the function calls to update a sheet.

What I mean is that sometimes it works sometimes it does not. So this
is how I fixed it.

Sub ScrollBar1_Change()

Application.Calculate '<< I put this same function twice, and it works
all the time
Application.Calculate '<< second call to this function updates whole
worksheet

End sub

This works fine unless I have around 3000 lines on a sheet, then I
really get problems updating twice that kind a sheet takes a long time.

May be there is a better way to fix it, I am new to Excel, just couple
of weeks since I've started this project.

The other problem I get is when I have that many lines on my sheet and
I put functions beyond column GE, they would not work. They work when I
do not have that many lines or they work if I put them before that
column.

For example

I would need to sum all the elements in column lets say HH so I put a
function SUM(HH:HH) and I get error. If I put SUM(HH1:HH3000) It works,
and it works if I do the same for other column or if I have less lines,
about 200. Bugs bugs bugs... everywhere :)

--
Intellihome
------------------------------------------------------------------------
Intellihome's Profile: http://www.msusenet.com/member.php?userid=1479
View this thread: http://www.msusenet.com/t-1870445918


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Autofill method of range class failed - sometimes


Thanks Dave,

you were right, there were some errors in the formula after certai
line. In fact it was marked by another programmer, whoever did tha
before me.

Thanks again, you saved me a lot of time.
Ivan

--
Intellihom
-----------------------------------------------------------------------
Intellihome's Profile: http://www.msusenet.com/member.php?userid=147
View this thread: http://www.msusenet.com/t-187044591

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Autofill method of range class failed - sometimes


Thanks Dave,

you were right, there were some errors in the formula after certai
line. In fact it was marked by another programmer, whoever did tha
before me.

Thanks again, you saved me a lot of time.
Ivan

--
Intellihom
-----------------------------------------------------------------------
Intellihome's Profile: http://www.msusenet.com/member.php?userid=147
View this thread: http://www.msusenet.com/t-187044591

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Autofill method of range class failed - sometimes


Thanks Dave,

you were right, there were some errors in the formula after certai
line. In fact it was marked by another programmer, whoever did tha
before me.

Thanks again, you saved me a lot of time.
Ivan

--
Intellihom
-----------------------------------------------------------------------
Intellihome's Profile: http://www.msusenet.com/member.php?userid=147
View this thread: http://www.msusenet.com/t-187044591

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Autofill method of range class failed - sometimes

Glad you got it working.

Intellihome wrote:

Thanks Dave,

you were right, there were some errors in the formula after certain
line. In fact it was marked by another programmer, whoever did that
before me.

Thanks again, you saved me a lot of time.
Ivan.

--
Intellihome
------------------------------------------------------------------------
Intellihome's Profile: http://www.msusenet.com/member.php?userid=1479
View this thread: http://www.msusenet.com/t-1870445918


--

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': AutoFill method of Range class failed murkaboris Excel Discussion (Misc queries) 10 April 16th 09 09:06 PM
Run-time error '1004': AutoFill method of Range class failed murkaboris Excel Discussion (Misc queries) 3 April 14th 09 10:35 PM
Autofill method of range class failed Don Guillett Excel Discussion (Misc queries) 0 February 27th 08 03:56 PM
Autofill method of range class failed Appache Excel Discussion (Misc queries) 5 February 27th 08 03:37 PM
AutoFit method of Range class failed Wellie[_2_] Excel Programming 1 February 29th 04 02:06 PM


All times are GMT +1. The time now is 06:48 PM.

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

About Us

"It's about Microsoft Excel"