Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
i'm trying to writ a macro that enters in a formula in a cell.
Scenario: Assume my cursor is in row 8 I want to put a formula of "=O$9" in cell M9 Here's what i've got so far (but its not working) dim x as integer lr=activecell.row 'tells me what row i'm on x=lr+1 'adds 1 to row number cells(x,13).select 'move my cursor to column M of row x ActiveCell.FormulaR1C1 = "=+RxC[2]" 'put the O$x formula in thanks in advance for any assistance. tami |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi Tami
Try the below Dim x As Integer lr = ActiveCell.Row 'tells me what row i'm on x = lr + 1 'adds 1 to row number Cells(x, 13).Formula = "=O$9" 'put the O$x formula in If this post helps click Yes --------------- Jacob Skaria "Tami" wrote: i'm trying to writ a macro that enters in a formula in a cell. Scenario: Assume my cursor is in row 8 I want to put a formula of "=O$9" in cell M9 Here's what i've got so far (but its not working) dim x as integer lr=activecell.row 'tells me what row i'm on x=lr+1 'adds 1 to row number cells(x,13).select 'move my cursor to column M of row x ActiveCell.FormulaR1C1 = "=+RxC[2]" 'put the O$x formula in thanks in advance for any assistance. tami |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Oops...correction
Dim x As Integer lr = ActiveCell.Row 'tells me what row i'm on x = lr + 1 'adds 1 to row number Cells(x, 13).Formula = "=O$" & x 'put the O$x formula in If this post helps click Yes --------------- Jacob Skaria "Tami" wrote: i'm trying to writ a macro that enters in a formula in a cell. Scenario: Assume my cursor is in row 8 I want to put a formula of "=O$9" in cell M9 Here's what i've got so far (but its not working) dim x as integer lr=activecell.row 'tells me what row i'm on x=lr+1 'adds 1 to row number cells(x,13).select 'move my cursor to column M of row x ActiveCell.FormulaR1C1 = "=+RxC[2]" 'put the O$x formula in thanks in advance for any assistance. tami |
#4
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
ActiveCell.FormulaR1C1 = "=R" & x & "C[2]"
or ActiveCell.FormulaR1C1 = "=RC[2]", which means "this row", 2 columns to the right -- Kind regards, Niek Otten Microsoft MVP - Excel "Tami" wrote in message ... i'm trying to writ a macro that enters in a formula in a cell. Scenario: Assume my cursor is in row 8 I want to put a formula of "=O$9" in cell M9 Here's what i've got so far (but its not working) dim x as integer lr=activecell.row 'tells me what row i'm on x=lr+1 'adds 1 to row number cells(x,13).select 'move my cursor to column M of row x ActiveCell.FormulaR1C1 = "=+RxC[2]" 'put the O$x formula in thanks in advance for any assistance. tami |
#5
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Thanks Niek. I realise; I missed the query all together..
"Niek Otten" wrote: ActiveCell.FormulaR1C1 = "=R" & x & "C[2]" or ActiveCell.FormulaR1C1 = "=RC[2]", which means "this row", 2 columns to the right -- Kind regards, Niek Otten Microsoft MVP - Excel "Tami" wrote in message ... i'm trying to writ a macro that enters in a formula in a cell. Scenario: Assume my cursor is in row 8 I want to put a formula of "=O$9" in cell M9 Here's what i've got so far (but its not working) dim x as integer lr=activecell.row 'tells me what row i'm on x=lr+1 'adds 1 to row number cells(x,13).select 'move my cursor to column M of row x ActiveCell.FormulaR1C1 = "=+RxC[2]" 'put the O$x formula in thanks in advance for any assistance. tami |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
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) | |||
What does hitting Ctrl + Shift + Enter to enter a formula do??? Help a n00b out. | Excel Worksheet Functions | |||
Make macro run when I hit the enter key | Excel Discussion (Misc queries) | |||
Can you enter a formula in a cell to run a macro? | Excel Worksheet Functions |