Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Enter formula in a macro
I would like to have a macro when clicked on any cell, would run a formula,
but I can't find any examples of how to do this. The formula is always in the same column referencing the same columns. (I know I could copy and paste, but the formulas are different for different items and I want to write a macro for each.) =round(col c - row whatever / 55.12, 0) Thanks! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Enter formula in a macro
Annette wrote: I would like to have a macro when clicked on any cell, would run a formula, but I can't find any examples of how to do this. The formula is always in the same column referencing the same columns. (I know I could copy and paste, but the formulas are different for different items and I want to write a macro for each.) =round(col c - row whatever / 55.12, 0) Thanks! Assuming the formula goes into cell A1 in the active workbook and sheet, and that the row is described by a defined variable called "whatever", try: range("A1").formula = "=round(c:" & whatever & "/55.12, 0)" |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Enter formula in a macro
ActiveCell.Formula = "=round(C" & activecell.row & "/ 55.12, 0)" or ActiveCell.FormulaR1C1 = "=Round(RC3/55.12,0)" -- Regards, Tom Ogilvy "Annette" wrote: I would like to have a macro when clicked on any cell, would run a formula, but I can't find any examples of how to do this. The formula is always in the same column referencing the same columns. (I know I could copy and paste, but the formulas are different for different items and I want to write a macro for each.) =round(col c - row whatever / 55.12, 0) Thanks! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Enter formula in a macro
Great ... this is exactly what I needed! And written so I can understand it
.... both ways. "Tom Ogilvy" wrote in message ... ActiveCell.Formula = "=round(C" & activecell.row & "/ 55.12, 0)" or ActiveCell.FormulaR1C1 = "=Round(RC3/55.12,0)" -- Regards, Tom Ogilvy "Annette" wrote: I would like to have a macro when clicked on any cell, would run a formula, but I can't find any examples of how to do this. The formula is always in the same column referencing the same columns. (I know I could copy and paste, but the formulas are different for different items and I want to write a macro for each.) =round(col c - row whatever / 55.12, 0) Thanks! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Using a macro to enter a formula | Excel Worksheet Functions | |||
Macro to select cells in column enter data then press enter | New Users to Excel | |||
Enter Static Date with a formula or macro | Excel Discussion (Misc queries) | |||
Can you enter a formula in a cell to run a macro? | Excel Worksheet Functions | |||
Macro to enter formula with text | Excel Programming |