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 problems

I have this really strange AutoFill problem.

Background:
I have a template (xls) which basically contains a sheet ("Main") with
one row with links to a another worksheet( within the same workbook of
course ) which we can call "data".
The row in the "Main" sheet contains 65 cells with links and formulas,
all based on the "data" sheet. So in order to populate the Main sheet I
use AutoFill ( made with VBA ) to fill as many rows as there are data
in the data sheet.
Example: If there are 1000 rows in sheet "data", then 1000 rows in the
"Main" sheet will be Autofilled.

Code for autofilling:
Range(strRangeStartLeft).Select // For instance row 1
Cells.Replace What:="X1", Replacement:="X2", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Range(strRangeStartLeft + ":" + strRangeStartRight).Select //
select the Range to Autofill
strRange = strRangeStartLeft + ":" + strRangeEnd
Selection.AutoFill Destination:=Range(strRange)

Problem:
All formulas are working perfectly in all cells in the way that they
are updated meaning that e.g formula =IF(AX6=0;0;AX6-(AC6*AU6)) will on
row 7 of course then be =IF(AX7=0;0;AX7-(AC7*AU7)) and so on...
HOWEVER! On row 10 and cell BA all the sudden the formula is
=IF(AX20=0;0;AX20-(AC10*AU10))
And then its incremented until row 20 and then the formula is correct:
=IF(AX20=0;0;AX20-(AC20*AU20))

Could someone please help me and explain this to me? how come one
single cell isn't Autofilled properly and with this extremely stange
pattern? The remaining 64 cells ( From A to BM ) works perfectly even
if I Autofill up to 10.000 rows. How could one single cell "have a life
of its one"?

Im all out if ideas how to correct or track down whats going on.

Please help me.

/Mattias

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 903
Default Autofill problems

I expect you rearranged some rows, possibly by sorting. You may
be able to fix by copying the good formula at or near the top downward.

As it is your code is filling in specific addresses.
You might take a look at
http://www.mvps.org/dmcritchie/excel/insrtrow.htm

---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

wrote in message oups.com...
I have this really strange AutoFill problem.

Background:
I have a template (xls) which basically contains a sheet ("Main") with
one row with links to a another worksheet( within the same workbook of
course ) which we can call "data".
The row in the "Main" sheet contains 65 cells with links and formulas,
all based on the "data" sheet. So in order to populate the Main sheet I
use AutoFill ( made with VBA ) to fill as many rows as there are data
in the data sheet.
Example: If there are 1000 rows in sheet "data", then 1000 rows in the
"Main" sheet will be Autofilled.

Code for autofilling:
Range(strRangeStartLeft).Select // For instance row 1
Cells.Replace What:="X1", Replacement:="X2", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Range(strRangeStartLeft + ":" + strRangeStartRight).Select //
select the Range to Autofill
strRange = strRangeStartLeft + ":" + strRangeEnd
Selection.AutoFill Destination:=Range(strRange)

Problem:
All formulas are working perfectly in all cells in the way that they
are updated meaning that e.g formula =IF(AX6=0;0;AX6-(AC6*AU6)) will on
row 7 of course then be =IF(AX7=0;0;AX7-(AC7*AU7)) and so on...
HOWEVER! On row 10 and cell BA all the sudden the formula is
=IF(AX20=0;0;AX20-(AC10*AU10))
And then its incremented until row 20 and then the formula is correct:
=IF(AX20=0;0;AX20-(AC20*AU20))

Could someone please help me and explain this to me? how come one
single cell isn't Autofilled properly and with this extremely stange
pattern? The remaining 64 cells ( From A to BM ) works perfectly even
if I Autofill up to 10.000 rows. How could one single cell "have a life
of its one"?

Im all out if ideas how to correct or track down whats going on.

Please help me.

/Mattias



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
aauugghhh...#div/o problems & various average formula problems acbel40 Excel Worksheet Functions 5 October 19th 09 05:00 PM
Autofill: Need to autofill one week block, (5) weekday only into cells. dstock Excel Discussion (Misc queries) 1 June 17th 05 08:21 PM
having problems with autofill on each sheet Xanth Excel Worksheet Functions 3 February 26th 05 02:20 AM
Problems with AutoFill xlDown macro on certain computers - DESPERA marika1981 Excel Programming 7 February 25th 05 12:42 AM
Q. Autofill question: Can I autofill alpha characters like I can numbers? George[_22_] Excel Programming 5 August 7th 04 10:33 AM


All times are GMT +1. The time now is 07:59 AM.

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"