ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copying Formulas Down Rows (https://www.excelbanter.com/excel-programming/365996-copying-formulas-down-rows.html)

J

Copying Formulas Down Rows
 
Hi there, I'm new to this group but I have a problem with Excel. Here
is the code I am using.

Sub AutoFillEquation()

Range("R4:AI4").AutoFill Destination:= _
Range("R4:AI" & Range("A" & Rows.Count).End(xlUp).Row), _
Type:=xlFillDefault


End Sub

The problem is that it does fill down the equations but they are not
calculating the values in the cells. It seems as if the values of the
first row are simply being pasted to the end (eventhough when I click
on the cell it displays the correct equation.

For example, in cell R9 there is the equation =I9+J9. The values in I9
and J9 are 5 and 7, respectively. However the answer in I9, as well as
every other value in column I, is 537 (the correct value for row 1 in
that column. When I retype the equation and hit enter it does work
however, but the macro is not working correctly. The reason I need the
macro is due to the changing number of rows and the file could get very
large otherwise.

Thanks for the help

Justin


Barb Reinhardt

Copying Formulas Down Rows
 
Try adding CALCULATE to your code.

"J" wrote:

Hi there, I'm new to this group but I have a problem with Excel. Here
is the code I am using.

Sub AutoFillEquation()

Range("R4:AI4").AutoFill Destination:= _
Range("R4:AI" & Range("A" & Rows.Count).End(xlUp).Row), _
Type:=xlFillDefault


End Sub

The problem is that it does fill down the equations but they are not
calculating the values in the cells. It seems as if the values of the
first row are simply being pasted to the end (eventhough when I click
on the cell it displays the correct equation.

For example, in cell R9 there is the equation =I9+J9. The values in I9
and J9 are 5 and 7, respectively. However the answer in I9, as well as
every other value in column I, is 537 (the correct value for row 1 in
that column. When I retype the equation and hit enter it does work
however, but the macro is not working correctly. The reason I need the
macro is due to the changing number of rows and the file could get very
large otherwise.

Thanks for the help

Justin



J

Copying Formulas Down Rows
 
Please explain how to use calculate and where to place in code.



Barb Reinhardt wrote:
Try adding CALCULATE to your code.

"J" wrote:

Hi there, I'm new to this group but I have a problem with Excel. Here
is the code I am using.

Sub AutoFillEquation()

Range("R4:AI4").AutoFill Destination:= _
Range("R4:AI" & Range("A" & Rows.Count).End(xlUp).Row), _
Type:=xlFillDefault


End Sub

The problem is that it does fill down the equations but they are not
calculating the values in the cells. It seems as if the values of the
first row are simply being pasted to the end (eventhough when I click
on the cell it displays the correct equation.

For example, in cell R9 there is the equation =I9+J9. The values in I9
and J9 are 5 and 7, respectively. However the answer in I9, as well as
every other value in column I, is 537 (the correct value for row 1 in
that column. When I retype the equation and hit enter it does work
however, but the macro is not working correctly. The reason I need the
macro is due to the changing number of rows and the file could get very
large otherwise.

Thanks for the help

Justin




Elkar

Copying Formulas Down Rows
 
Place in the final line before your End Sub.

Calculate
End Sub

HTH,
Elkar


"J" wrote:

Please explain how to use calculate and where to place in code.



Barb Reinhardt wrote:
Try adding CALCULATE to your code.

"J" wrote:

Hi there, I'm new to this group but I have a problem with Excel. Here
is the code I am using.

Sub AutoFillEquation()

Range("R4:AI4").AutoFill Destination:= _
Range("R4:AI" & Range("A" & Rows.Count).End(xlUp).Row), _
Type:=xlFillDefault


End Sub

The problem is that it does fill down the equations but they are not
calculating the values in the cells. It seems as if the values of the
first row are simply being pasted to the end (eventhough when I click
on the cell it displays the correct equation.

For example, in cell R9 there is the equation =I9+J9. The values in I9
and J9 are 5 and 7, respectively. However the answer in I9, as well as
every other value in column I, is 537 (the correct value for row 1 in
that column. When I retype the equation and hit enter it does work
however, but the macro is not working correctly. The reason I need the
macro is due to the changing number of rows and the file could get very
large otherwise.

Thanks for the help

Justin





comparini3000

Copying Formulas Down Rows
 
or you could try this at the beginning of your sub:

Application.Calculation = xlCalculationAutomatic

"J" wrote:

Please explain how to use calculate and where to place in code.



Barb Reinhardt wrote:
Try adding CALCULATE to your code.

"J" wrote:

Hi there, I'm new to this group but I have a problem with Excel. Here
is the code I am using.

Sub AutoFillEquation()

Range("R4:AI4").AutoFill Destination:= _
Range("R4:AI" & Range("A" & Rows.Count).End(xlUp).Row), _
Type:=xlFillDefault


End Sub

The problem is that it does fill down the equations but they are not
calculating the values in the cells. It seems as if the values of the
first row are simply being pasted to the end (eventhough when I click
on the cell it displays the correct equation.

For example, in cell R9 there is the equation =I9+J9. The values in I9
and J9 are 5 and 7, respectively. However the answer in I9, as well as
every other value in column I, is 537 (the correct value for row 1 in
that column. When I retype the equation and hit enter it does work
however, but the macro is not working correctly. The reason I need the
macro is due to the changing number of rows and the file could get very
large otherwise.

Thanks for the help

Justin






All times are GMT +1. The time now is 12:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com