Jurij
08-12-2013, 02:03 AM
Hi guys,
I have a small problem with a macro in Excel. I am using the following code:
Sheet17.Range("A19:M" & Range("A19").End(xlDown).Row).ClearContents
Sheet17.Range("A18:M18").AutoFill Destination:=Sheet17.Range("A18:M" & Range("Periods") + 17), Type:=xlFillDefault
Now just to make a quick introduction. I have some calculations for products that act differently in different periods. So if the product has 3 different periods, for example, the autofill expands from Period 1 (that is the row where the original formulas are) to Period 3. Everything works fine except when the product has only 1 period. In this case the autofill shouldn't expand down but stay where it is and it seems that if it doesn't get to expand (the cell "Periods" is 1), it doesn't work.
When it comes to those products with only one period, I get an "Autofill Method of Range Class Failed" error and I have no idea how to debug this.
Any help is much appreciated
Thank you
Jurij
I have a small problem with a macro in Excel. I am using the following code:
Sheet17.Range("A19:M" & Range("A19").End(xlDown).Row).ClearContents
Sheet17.Range("A18:M18").AutoFill Destination:=Sheet17.Range("A18:M" & Range("Periods") + 17), Type:=xlFillDefault
Now just to make a quick introduction. I have some calculations for products that act differently in different periods. So if the product has 3 different periods, for example, the autofill expands from Period 1 (that is the row where the original formulas are) to Period 3. Everything works fine except when the product has only 1 period. In this case the autofill shouldn't expand down but stay where it is and it seems that if it doesn't get to expand (the cell "Periods" is 1), it doesn't work.
When it comes to those products with only one period, I get an "Autofill Method of Range Class Failed" error and I have no idea how to debug this.
Any help is much appreciated
Thank you
Jurij