Make VBA Enter Formula into cell rather than calculation
How would I make say Cell C1's value be "A1+B1",
rather than the caluculation of A1+B1 i.e. 4 Don't want the number 4 to show in the formula bar. Because I'd like to autofill the formula and not the number 4 down the column of a similiar calculation. I'd like to learn how to code something like that. Then I can apply it to several different macros I have. I want VBA to enter the formula into a cell rather than the resulting answer.. is this possible? |
Make VBA Enter Formula into cell rather than calculation
With numbers in colA and B the below code will assign the formula A+B in ColC
.. Try with dummy data in ColA and ColB... Sub Macro() Dim rngData As Range Set rngData = Range("C1:C" & Cells(Rows.Count, "A").End(xlUp).Row) rngData.Formula = "=A1+B1" End Sub If this post helps click Yes --------------- Jacob Skaria "Benjamin" wrote: How would I make say Cell C1's value be "A1+B1", rather than the caluculation of A1+B1 i.e. 4 Don't want the number 4 to show in the formula bar. Because I'd like to autofill the formula and not the number 4 down the column of a similiar calculation. I'd like to learn how to code something like that. Then I can apply it to several different macros I have. I want VBA to enter the formula into a cell rather than the resulting answer.. is this possible? |
All times are GMT +1. The time now is 12:56 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com