Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
copying formulas when inserting new rows | Excel Discussion (Misc queries) | |||
Inserting multiple rows and copying formulas | Excel Discussion (Misc queries) | |||
Copying rows/formulas | Excel Programming | |||
SOS - My formulas aren't computing down my rows but copying same | Excel Worksheet Functions | |||
Counting Rows/Columns for Copying Formulas | Excel Discussion (Misc queries) |